// 清空集合
void clear()
// 返回集合中元素的个数
int size()
// 返回集合的哈希值
int hashCode()
// 比较参数和集合的值,相等则返回true
boolean equals(Object o)
// 判断集合是否为空,为空返回true
boolean isEmpty()
// 向集合中添加元素,添加成功返回true
boolean add(E e)
// 将参数集合中的所有元素添加到集合中,泛型上限确定
boolean addAll(Collection<? extends E> c)
// 将元素从集合中移除,移除成功返回true
boolean remove(E e)
// 将符合参数描述的元素从集合中移除,成功则返回true,泛型下限确定
default boolean removeIf(Predicate<? super E> filter)
// 将参数集合中的所有元素从集合中移除,移除成功返回true
boolean removeAll(Collection<?> c)
// 判断集合中是否包含元素,包含返回true
boolean contains(E e)
// 判断集合中是否包含参数集合中的全部元素,包含则返回true
boolean containsAll(Collection<?> c)
// 持久化。将集合中不存在于参数集合中的元素移除,有的继续保留在集合中,成功则返回true
boolean retainAll(Collection<?> c)
// 将集合中的元素保存到数组中
Object[] toArray()
// 返回迭代器
Iterator<E> iterator()
Collection类API
最新推荐文章于 2023-03-09 17:42:34 发布