Collection
A group of elements. List is one.
InterfaceJavaJava 11 docs
public interface Collection<E> extends Iterable<E>Members
Methods
- booleanisEmpty()
Whether there are no elements.
- Iterator<E>iterator()
Walks over the elements. A
forloop does this for you. - intsize()
The number of elements.
isEmpty()
public boolean isEmpty()Whether there are no elements.
Returns
true if it is empty.
iterator()
public Iterator<E> iterator()Walks over the elements. A for loop does this for you.
Returns
An Iterator.
size()
public int size()The number of elements.
Returns
The size.
Also allowed
These work as in the Java 11 docs.
add, addAll, clear, contains, containsAll, equals, forEach, hashCode, remove, removeAll, removeIf, retainAll, stream, toArray, toString