E - the type of elements in this collectionpublic interface ObjCollection<E> extends Collection<E>, Container
Collection interface.
All methods of Collection interface defined in terms of elements equality and
referring to Object.equals(Object) method are supposed to use equivalence()
in this interface. Thus in some sense ObjCollection violates general Collection
contract, but this approach provides a great flexibility. If you need strict Collection
implementation, you can always construct an ObjCollection with default equality,
i. e. equivalence() == Equivalence.defaultEquality().
See Collection
mutability matrix for methods which are supported by ObjCollections with the specific
mutability. All methods defined in this interface directly are supported
by ObjCollections with any mutability profile.
| Modifier and Type | Method and Description |
|---|---|
ObjCursor<E> |
cursor()
Returns a new cursor over this collection's elements.
|
Equivalence<E> |
equivalence()
Returns the equivalence strategy for elements in this collection.
|
boolean |
forEachWhile(Predicate<? super E> predicate)
Checks the given
predicate on each element of this collection until all element
have been processed or the predicate returns false for some element,
or throws an Exception. |
ObjIterator<E> |
iterator()
Returns a new iterator over this collection's elements.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayclear, ensureCapacity, isEmpty, shrink, size, sizeAsLong@Nonnull Equivalence<E> equivalence()
Collection interface which defined in terms of Object.equals(Object)
equality of elements, for example, Collection.contains(Object) and Collection.remove(Object),
are supposed to use this equivalence instead.boolean forEachWhile(@Nonnull Predicate<? super E> predicate)
predicate on each element of this collection until all element
have been processed or the predicate returns false for some element,
or throws an Exception. Exceptions thrown by the predicate are relayed to the caller.
Unless otherwise specified by the implementing class, elements are checked by the predicate in the order of iteration (if an iteration order is specified).
If this collection is empty, this method returns true immediately.
predicate - the predicate to be checked for each element of this collectiontrue if the predicate returned true for all elements of this
collection, false if it returned false for the element@Nonnull ObjCursor<E> cursor()
@Nonnull ObjIterator<E> iterator()
iterator in interface Collection<E>iterator in interface Iterable<E>