Java面向对象10-Collection接口

Collection接口常用方法:

boolean add(E e) 把给定的对象添加到当前集合中。
void clear()  清空集合中所有的元素。
boolean remove(E e) 把给定的对象在当前集合中删除。
boolean contains(E e) 判断当前集合中是否包含给定的对象。
boolean isEmpty() 判断当前集合是否为空。
int size() 返回集合中元素的个数。
Object[] toArray() 把集合中的元素,存储到数组中。

 

posted @ 2022-05-16 22:29  草莓小甜心  阅读(39)  评论(0)    收藏  举报