|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- the type of elements in this collectionpublic interface ObjCollection<E>
A collection of objects, the library's extension of the classic 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. Among methods,
defined in this interface directly, removeIf(Predicate)
is supported only by collections
of mutable profile, others are supported by ObjCollections
with any mutability
profile.
Method Summary | |
---|---|
ObjCursor<E> |
cursor()
Returns a new cursor over this collection's elements. |
Equivalence<E> |
equivalence()
Returns the equivalence strategy for elements in this collection. |
void |
forEach(Consumer<? super E> action)
Performs the given action for each element of this collection until all elements have been processed or the action throws an exception. |
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. |
boolean |
removeIf(Predicate<? super E> filter)
Removes all of the elements of this collection that satisfy the given predicate. |
Methods inherited from interface Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface com.koloboke.collect.Container |
---|
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong |
Method Detail |
---|
@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.
void forEach(@Nonnull Consumer<? super E> action)
action
- the action to be performed for each elementboolean 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 collection
true
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>
boolean removeIf(@Nonnull Predicate<? super E> filter)
filter
- a predicate which returns true
for elements to be removed
true
if any elements were removed
NullPointerException
- if the specified filter is null
UnsupportedOperationException
- if elements cannot be removed from this collection.
Implementations may throw this exception if a matching element cannot be removed
or if, in general, removal is not supported.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |