Class CheckedHashSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.HashSet<E>
java.util.LinkedHashSet<E>
org.apache.sis.internal.util.CheckedHashSet<E>
- Type Parameters:
E- the type of elements in the set.
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>, CheckedContainer<E>
A checked
LinkedHashSet.
The type checks are performed at run-time in addition to the compile-time checks.
Using this class is similar to wrapping a LinkedHashSet using the methods provided
in the standard Collections class, except for the following differences:
- Avoid one level of indirection.
- Does not accept null elements.
- Since:
- 0.3
- Version:
- 0.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longSerial version UID for compatibility with different versions.The element type. -
Constructor Summary
ConstructorsConstructorDescriptionCheckedHashSet(Class<E> type) Constructs a set of the specified type.CheckedHashSet(Class<E> type, int capacity) Constructs a set of the specified type and initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the specified element to this set if it is not already present.Returns the element type given at construction time.Methods inherited from class LinkedHashSet
spliteratorMethods inherited from class AbstractSet
equals, hashCode, removeAllMethods inherited from class AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial version UID for compatibility with different versions.- See Also:
-
type
-
-
Constructor Details
-
CheckedHashSet
-
CheckedHashSet
-
-
Method Details
-
getElementType
Returns the element type given at construction time.- Specified by:
getElementTypein interfaceCheckedContainer<E>- Returns:
- the element type.
-
add
Adds the specified element to this set if it is not already present.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classHashSet<E>- Parameters:
element- element to be added to this set.- Returns:
trueif the set did not already contain the specified element.- Throws:
IllegalArgumentException- if the specified element is not of the expected type.
-