码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA 集合---collection定义的需方法

时间:2020-02-16 13:15:35      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:ram   eth   ret   OLE   定义   title   runtime   opera   run   

 

引用自 JAVA SE API

boolean add(E e)
Ensures that this collection contains the specified element (optional operation).
boolean addAll(Collection<? extends E> c)
Adds all of the elements in the specified collection to this collection (optional operation).
void clear()
Removes all of the elements from this collection (optional operation).
boolean contains(Object o)
Returns true if this collection contains the specified element.
boolean containsAll(Collection<?> c)
Returns true if this collection contains all of the elements in the specified collection.
boolean isEmpty()
Returns true if this collection contains no elements.
abstract Iterator<E> iterator()
Returns an iterator over the elements contained in this collection.
boolean remove(Object o)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
boolean removeAll(Collection<?> c)
Removes all of this collection‘s elements that are also contained in the specified collection (optional operation).
boolean retainAll(Collection<?> c)
Retains only the elements in this collection that are contained in the specified collection (optional operation).
abstract int size()
Returns the number of elements in this collection.
Object[] toArray()
Returns an array containing all of the elements in this collection.
<T> T[] toArray(T[] a)
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
String toString()
Returns a string representation of this collection.

JAVA 集合---collection定义的需方法

标签:ram   eth   ret   OLE   定义   title   runtime   opera   run   

原文地址:https://www.cnblogs.com/superxuezhazha/p/12316219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!