Package org.apache.sis.util.collection
Class DerivedSet.Bijective<S,E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.sis.internal.util.SetOfUnknownSize<E>
org.apache.sis.util.collection.DerivedSet<S,E>
org.apache.sis.util.collection.DerivedSet.Invertible<S,E>
org.apache.sis.util.collection.DerivedSet.Bijective<S,E>
- Type Parameters:
S- the type of elements in the storage set.E- the type of elements in this set.
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>,CheckedContainer<E>
- Enclosing class:
- DerivedSet<S,
E>
A
DerivedSet for converters that are both invertible and bijective.
The bijection allows us to query the DerivedSet.storage set size directly
instead of iterating over all elements.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longFor cross-version compatibility.Fields inherited from class org.apache.sis.util.collection.DerivedSet
converter, storage -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.sis.util.collection.DerivedSet.Invertible
add, contains, removeMethods inherited from class org.apache.sis.util.collection.DerivedSet
add, create, getElementType, iteratorMethods inherited from class org.apache.sis.internal.util.SetOfUnknownSize
equals, isSizeKnown, removeAll, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSet
hashCodeMethods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, retainAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.Set
addAll, clear, containsAll, retainAll
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
-
Constructor Details
-
Bijective
Bijective(Set<S> storage, ObjectConverter<S, E> converter) Creates a new derived set from the specified storage set.- Parameters:
storage- the set which actually store the elements.converter- the type of elements in this derived set.
-
-
Method Details
-
size
public int size()Returns the number of elements in this set. The default implementation counts the number of elements returned by the iterator. Subclasses are encouraged to cache this value if they know that the underlying storage is immutable.- Specified by:
sizein interfaceCollection<S>- Specified by:
sizein interfaceSet<S>- Overrides:
sizein classSetOfUnknownSize<E>- Returns:
- the number of elements in this set.
-
isEmpty
public boolean isEmpty()Returnstrueif this set contains no elements.- Specified by:
isEmptyin interfaceCollection<S>- Specified by:
isEmptyin interfaceSet<S>- Overrides:
isEmptyin classDerivedSet<S,E> - Returns:
trueif this set contains no elements.
-