Module org.apache.jena.core
Package org.apache.jena.mem.collection
Interface JenaSetHashOptimized<E>
- Type Parameters:
E- the element type of the set
- All Superinterfaces:
Iterable<E>,JenaMapSetCommon<E>,JenaSet<E>,Sized
- All Known Subinterfaces:
FastTripleBunch,JenaSetIndexed<E>
- All Known Implementing Classes:
FastArrayBunch,FastHashedTripleBunch,FastHashSet,TripleSet,TripleSet
Extension of
JenaSet that lets callers supply a precomputed hash
code.
Attention: any caller-supplied hash code MUST equal E.hashCode();
if it does not, the set will misbehave.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddUnchecked(E key, int hashCode) Add an element with the given precomputed hash code without checking whether it is already present.voidremoveUnchecked(E key, int hashCode) Remove an element assumed to be present, with the given precomputed hash code.booleanAdd an element with the given precomputed hash code if it is not already present.booleanTry to remove an element with the given precomputed hash code.Methods inherited from interface org.apache.jena.mem.collection.JenaMapSetCommon
anyMatch, clear, containsKey, isEmpty, keyIterator, keySpliterator, keyStream, keyStreamParallel, removeUnchecked, tryRemoveMethods inherited from interface org.apache.jena.mem.collection.JenaSet
addUnchecked, forEach, iterator, spliterator, tryAdd
-
Method Details
-
tryAdd
Add an element with the given precomputed hash code if it is not already present.- Parameters:
key- the element to add. (nullis not allowed)hashCode-key.hashCode().- Returns:
trueif added,falseif already present
-
addUnchecked
Add an element with the given precomputed hash code without checking whether it is already present. The caller MUST ensure the key is absent.- Parameters:
key- the element to add. (nullis not allowed)hashCode-key.hashCode(). (nullis not allowed)
-
tryRemove
Try to remove an element with the given precomputed hash code.- Parameters:
key- the element to removehashCode-key.hashCode()- Returns:
trueif removed,falseif it was not present
-
removeUnchecked
Remove an element assumed to be present, with the given precomputed hash code. Behavior is undefined if the element is not in the set.- Parameters:
key- the element to removehashCode-key.hashCode()
-