Package one.microstream.collections
Class EqConstHashTable.Keys
java.lang.Object
one.microstream.collections.EqConstHashTable.Keys
- All Implemented Interfaces:
Iterable<K>,CapacityCarrying,ExtendedCollection<K>,ExtendedSequence<K>,HashCollection<K>,Sized,XGettingCollection<K>,XGettingEnum<K>,XGettingMap.Keys<K,V>,XGettingMap.Satellite<K,V>,XGettingSequence<K>,XGettingSet<K>,XGettingTable.Keys<K,V>,XGettingTable.Satellite<K,V>,XImmutableCollection<K>,XImmutableEnum<K>,XImmutableMap.Keys<K,V>,XImmutableMap.Satellite<K,V>,XImmutableSequence<K>,XImmutableSet<K>,XImmutableTable.Keys<K,V>,XIndexIterable<K>,XIterable<K>,XJoinable<K>,ThreadSafe,HashImmutable,ComponentType,Copyable,Immutable
- Enclosing class:
- EqConstHashTable<K,V>
public final class EqConstHashTable.Keys extends Object implements XImmutableTable.Keys<K,V>, HashCollection<K>
-
Nested Class Summary
Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.ExtendedCollection
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.HashCollection
HashCollection.Analysis<H>Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingCollection
XGettingCollection.Creator<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingEnum
XGettingEnum.Creator<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingSequence
XGettingSequence.Factory<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingSet
XGettingSet.Creator<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XImmutableEnum
XImmutableEnum.Factory<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XImmutableSet
XImmutableSet.Factory<E>Nested classes/interfaces inherited from interface one.microstream.collections.types.XIterable
XIterable.Executor<E> -
Field Summary
Fields inherited from interface one.microstream.collections.interfaces.HashCollection
DEFAULT_HASH_FACTOR, DEFAULT_HASH_LENGTH -
Constructor Summary
Constructors Constructor Description Keys() -
Method Summary
Modifier and Type Method Description HashCollection.Analysis<EqConstHashTable.Keys>analyze()booleanapplies(Predicate<? super K> predicate)Kat(long index)booleancontains(K element)booleancontainsAll(XGettingCollection<? extends K> elements)booleancontainsId(K element)Special version of contains() that guarantees to use identity comparison (" == ") when searching for the given element regardless of the collection's internal logic.
This method has the same behavior asXGettingCollection.containsSearched(Predicate)with aPredicateimplementation that checks for object identity.booleancontainsSearched(Predicate<? super K> predicate)EqConstHashTable.Keyscopy()Creates a true copy of this collection which references the same elements as this collection does at the time the method is called.<T extends Consumer<? super K>>
TcopySelection(T target, long... indices)<C extends Consumer<? super K>>
CcopyTo(C target)longcount(K element)longcountBy(Predicate<? super K> predicate)<C extends Consumer<? super K>>
Cdistinct(C target)<C extends Consumer<? super K>>
Cdistinct(C target, Equalator<? super K> equalator)Equalator<? super K>equality()booleanequals(XGettingCollection<? extends K> samples, Equalator<? super K> equalator)Returnstrueif the passed collection is of the same type as this collection andthis.equalsContent(list, equalator)yieldstrue.booleanequalsContent(XGettingCollection<? extends K> samples, Equalator<? super K> equalator)Returnstrueif all elements of this list and the passed list are sequentially equal as defined by the passed equalator.<C extends Consumer<? super K>>
Cexcept(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)<C extends Consumer<? super K>>
CfilterTo(C target, Predicate<? super K> predicate)Kfirst()Kget()Gets one element from the collection.floathashDensity()inthashDistributionRange()HashEqualator<? super K>hashEquality()booleanhasVolatileElements()Tells if this collection contains volatile elements.
An element is volatile, if it can become no longer reachable by the collection without being removed from the collection.booleanhasVolatileHashElements()EqConstHashTable.Keysimmure()This method creates aEqConstHashEnuminstance containing all (currently existing) elements of thisEqConstHashTable.
No matter which hashing logic this instance uses, the newEqConstHashEnuminstance always uses a STRONG EQUALATOR logic, using this instance's logic'sHashEqualator.
This is necessary to ensure that theEqConstHashEnuminstance is really constant and does not (can not!) lose elements over time.
If aEqConstHashEnumwith volatile elements is needed (e.g.longindexBy(Predicate<? super K> predicate)longindexOf(K element)<C extends Consumer<? super K>>
Cintersect(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)booleanisEmpty()booleanisFull()Returns true if the current capacity cannot be increased any more.booleanisSorted(Comparator<? super K> comparator)<P extends Consumer<? super K>>
Piterate(P procedure)<P extends IndexedAcceptor<? super K>>
PiterateIndexed(P procedure)Iterator<K>iterator()<A> Ajoin(BiConsumer<? super K,? super A> joiner, A aggregate)Klast()longlastIndexBy(Predicate<? super K> predicate)longlastIndexOf(K element)Kmax(Comparator<? super K> comparator)longmaximumCapacity()Returns the maximum amount of elements this carrier instance can contain.
The actual value may be depend on the configuration of the concrete instance or may depend only on the implementation of the carrier (meaning it is constant for all instances of the implementation, e.g.longmaxIndex(Comparator<? super K> comparator)Kmin(Comparator<? super K> comparator)longminIndex(Comparator<? super K> comparator)booleannullAllowed()booleannullContained()OldCollection<K>old()EqConstHashTable<K,V>parent()Kpeek()Kpoll()XEnum<K>range(long lowIndex, long highIndex)intrehash()Recalculates the hash value of all entries and reorginazes and optimizes the hash storage accordingly.longremainingCapacity()Returns the amount of elements this carrier instance can collect before reaching its maximimum capacity.longscan(Predicate<? super K> predicate)Iterates through the collection and returns the index of the last element that the passedPredicateapplied to ("scanning").Ksearch(Predicate<? super K> predicate)Kseek(K sample)Returns the first contained element matching the passed sample as defined by the collection's equality logic or null, if no fitting element is contained.voidsetHashDensity(float hashDensity)Sets the hash density (1/density) of this hashing collection if applicable.longsize()Object[]toArray()K[]toArray(Class<K> type)EqConstHashTable.KeystoReversed()StringtoString()<C extends Consumer<? super K>>
Cunion(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)XGettingEnum<K>view()XGettingEnum<K>view(long lowIndex, long highIndex)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface one.microstream.collections.types.XGettingCollection
equals, hashCode, intSize
-
Constructor Details
-
Keys
public Keys()
-
-
Method Details
-
hashDistributionRange
public final int hashDistributionRange()- Specified by:
hashDistributionRangein interfaceHashCollection<K>
-
hasVolatileHashElements
public final boolean hasVolatileHashElements()- Specified by:
hasVolatileHashElementsin interfaceHashCollection<K>
-
setHashDensity
public final void setHashDensity(float hashDensity)Description copied from interface:HashCollectionSets the hash density (1/density) of this hashing collection if applicable.If this procedure is not applicable for the hash collection (e.g. an immutable hash collection), calling this method has no effect.
- Specified by:
setHashDensityin interfaceHashCollection<K>- Parameters:
hashDensity- the new hash density to be set.
-
analyze
- Specified by:
analyzein interfaceHashCollection<K>
-
rehash
public final int rehash()Description copied from interface:HashCollectionRecalculates the hash value of all entries and reorginazes and optimizes the hash storage accordingly. This method is meant for cases where a hash collection has to collect its elements before proper hash values can be derived for them or where hash mutable elements can change their hash-relevant state after having been added (and hashed) in a hash collection. Note that depending on the hash-relevant state of elements and their changing of it, it can be possible that some elements oust others, thus decreasing the collection's size. This behavior depends on the type of the elements and the used hash logic and cannot be compensated by a general purpose collection implementation.- Specified by:
rehashin interfaceHashCollection<K>- Returns:
- the new size of the collection which might be lower than before the call.
-
equality
- Specified by:
equalityin interfaceXGettingCollection<K>
-
copy
Description copied from interface:XGettingCollectionCreates a true copy of this collection which references the same elements as this collection does at the time the method is called. The elements themselves are NOT copied (no deep copying).
The type of the returned set is the same as of this list if possible.- Specified by:
copyin interfaceCopyable- Specified by:
copyin interfaceXGettingCollection<K>- Specified by:
copyin interfaceXGettingEnum<K>- Specified by:
copyin interfaceXGettingSequence<K>- Specified by:
copyin interfaceXGettingSet<K>- Specified by:
copyin interfaceXImmutableCollection<K>- Specified by:
copyin interfaceXImmutableEnum<K>- Specified by:
copyin interfaceXImmutableSequence<K>- Specified by:
copyin interfaceXImmutableSet<K>- Specified by:
copyin interfaceXImmutableTable.Keys<K,V>- Returns:
- a copy of this list
-
immure
This method creates aEqConstHashEnuminstance containing all (currently existing) elements of thisEqConstHashTable.
No matter which hashing logic this instance uses, the newEqConstHashEnuminstance always uses a STRONG EQUALATOR logic, using this instance's logic'sHashEqualator.
This is necessary to ensure that theEqConstHashEnuminstance is really constant and does not (can not!) lose elements over time.
If aEqConstHashEnumwith volatile elements is needed (e.g. as a "read-only weak set"), an appropriate custom behaviorEqConstHashEnuminstance can be created via the various copy constructors.- Specified by:
immurein interfaceXGettingCollection<K>- Specified by:
immurein interfaceXGettingEnum<K>- Specified by:
immurein interfaceXGettingMap.Keys<K,V>- Specified by:
immurein interfaceXGettingSequence<K>- Specified by:
immurein interfaceXGettingSet<K>- Specified by:
immurein interfaceXImmutableCollection<K>- Specified by:
immurein interfaceXImmutableEnum<K>- Specified by:
immurein interfaceXImmutableSequence<K>- Specified by:
immurein interfaceXImmutableSet<K>- Returns:
- a new
EqConstHashEnuminstance strongly referencing this set's current elements. - See Also:
XImmutableCollection.copy()
-
view
- Specified by:
viewin interfaceXGettingCollection<K>- Specified by:
viewin interfaceXGettingEnum<K>- Specified by:
viewin interfaceXGettingSequence<K>
-
range
- Specified by:
rangein interfaceXGettingEnum<K>- Specified by:
rangein interfaceXGettingSequence<K>
-
view
- Specified by:
viewin interfaceXGettingEnum<K>- Specified by:
viewin interfaceXGettingSequence<K>
-
toArray
- Specified by:
toArrayin interfaceXGettingCollection<K>
-
iterate
- Specified by:
iteratein interfaceXGettingEnum<K>- Specified by:
iteratein interfaceXGettingSet<K>- Specified by:
iteratein interfaceXIterable<K>
-
join
-
count
- Specified by:
countin interfaceXGettingCollection<K>
-
countBy
- Specified by:
countByin interfaceXGettingCollection<K>
-
seek
Description copied from interface:XGettingCollectionReturns the first contained element matching the passed sample as defined by the collection's equality logic or null, if no fitting element is contained. (For collections using referential equality, this method is basically just a variation ofXGettingCollection.contains(Object)with a different return type. For collections with data-dependant equality, the returned element might be the same as the passed one or a data-wise equal one, depending on the content of the collection)- Specified by:
seekin interfaceXGettingCollection<K>
-
search
- Specified by:
searchin interfaceXGettingCollection<K>
-
max
- Specified by:
maxin interfaceXGettingCollection<K>
-
min
- Specified by:
minin interfaceXGettingCollection<K>
-
hasVolatileElements
public final boolean hasVolatileElements()Description copied from interface:XGettingCollectionTells if this collection contains volatile elements.
An element is volatile, if it can become no longer reachable by the collection without being removed from the collection. Examples areWeakReferenceofSoftReferenceor implementations of collection entries that remove the element contained in an entry by some means outside the collection.
Note thatWeakReferenceinstances that are added to a a simple (non-volatile) implementation of a collection do NOT make the collection volatile, as the elements themselves (the reference instances) are still strongly referenced.- Specified by:
hasVolatileElementsin interfaceExtendedCollection<K>- Specified by:
hasVolatileElementsin interfaceXGettingCollection<K>- Returns:
trueif the collection contains volatile elements.
-
nullAllowed
public final boolean nullAllowed()- Specified by:
nullAllowedin interfaceExtendedCollection<K>
-
containsSearched
- Specified by:
containsSearchedin interfaceXGettingCollection<K>
-
applies
- Specified by:
appliesin interfaceXGettingCollection<K>
-
nullContained
public final boolean nullContained()- Specified by:
nullContainedin interfaceXGettingCollection<K>
-
containsId
Description copied from interface:XGettingCollectionSpecial version of contains() that guarantees to use identity comparison (" == ") when searching for the given element regardless of the collection's internal logic.
This method has the same behavior asXGettingCollection.containsSearched(Predicate)with aPredicateimplementation that checks for object identity. The only difference is a performance and usability advantage- Specified by:
containsIdin interfaceXGettingCollection<K>- Parameters:
element- the element to be searched in the collection by identity.- Returns:
- whether this collection contains exactely the given element.
-
contains
- Specified by:
containsin interfaceXGettingCollection<K>
-
containsAll
- Specified by:
containsAllin interfaceXGettingCollection<K>
-
equals
public final boolean equals(XGettingCollection<? extends K> samples, Equalator<? super K> equalator)Description copied from interface:XGettingCollectionReturnstrueif the passed collection is of the same type as this collection andthis.equalsContent(list, equalator)yieldstrue.- Specified by:
equalsin interfaceXGettingCollection<K>
-
equalsContent
public final boolean equalsContent(XGettingCollection<? extends K> samples, Equalator<? super K> equalator)Description copied from interface:XGettingCollectionReturnstrueif all elements of this list and the passed list are sequentially equal as defined by the passed equalator.Note that for colletion types that don't have a defined order of elements, this method is hardly usable (as is
XGettingCollection.equals(Object)for them as defined inCollection). The core problem of comparing collections that have no defined order is that they aren't really reliably comparable to any other collection.- Specified by:
equalsContentin interfaceXGettingCollection<K>equalator- the equalator to use to determine the equality of each element- Returns:
trueif this list is equal to the passed list, false otherwise
-
intersect
public final <C extends Consumer<? super K>> C intersect(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)- Specified by:
intersectin interfaceXGettingCollection<K>
-
except
public final <C extends Consumer<? super K>> C except(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)- Specified by:
exceptin interfaceXGettingCollection<K>
-
union
public final <C extends Consumer<? super K>> C union(XGettingCollection<? extends K> other, Equalator<? super K> equalator, C target)- Specified by:
unionin interfaceXGettingCollection<K>
-
copyTo
- Specified by:
copyToin interfaceXGettingCollection<K>
-
filterTo
- Specified by:
filterToin interfaceXGettingCollection<K>
-
distinct
- Specified by:
distinctin interfaceXGettingCollection<K>
-
distinct
- Specified by:
distinctin interfaceXGettingCollection<K>
-
maximumCapacity
public final long maximumCapacity()Description copied from interface:CapacityCarryingReturns the maximum amount of elements this carrier instance can contain.
The actual value may be depend on the configuration of the concrete instance or may depend only on the implementation of the carrier (meaning it is constant for all instances of the implementation, e.g.Integer.MAX_VALUE)- Specified by:
maximumCapacityin interfaceCapacityCarrying- Returns:
- the maximum amount of elements this carrier instance can contain.
-
isFull
public final boolean isFull()Description copied from interface:CapacityCarryingReturns true if the current capacity cannot be increased any more.- Specified by:
isFullin interfaceCapacityCarrying
-
remainingCapacity
public final long remainingCapacity()Description copied from interface:CapacityCarryingReturns the amount of elements this carrier instance can collect before reaching its maximimum capacity.- Specified by:
remainingCapacityin interfaceCapacityCarrying
-
toReversed
- Specified by:
toReversedin interfaceXGettingEnum<K>- Specified by:
toReversedin interfaceXGettingSequence<K>- Specified by:
toReversedin interfaceXImmutableEnum<K>- Specified by:
toReversedin interfaceXImmutableSequence<K>
-
copySelection
- Specified by:
copySelectionin interfaceXGettingSequence<K>
-
iterateIndexed
- Specified by:
iterateIndexedin interfaceXIndexIterable<K>
-
at
- Specified by:
atin interfaceXGettingSequence<K>
-
get
Description copied from interface:XGettingCollectionGets one element from the collection. If the collection is not orderedXGettingSequence, then it is undefined which element is returned. If the collection is ordered, the element at index 0 is returned.- Specified by:
getin interfaceXGettingCollection<K>- Specified by:
getin interfaceXGettingSequence<K>- Returns:
- the first / any element.
- See Also:
XGettingSequence.at(long),XGettingSequence.first(),XGettingSequence.last()
-
first
- Specified by:
firstin interfaceXGettingSequence<K>
-
last
- Specified by:
lastin interfaceXGettingSequence<K>
-
poll
- Specified by:
pollin interfaceXGettingSequence<K>
-
peek
- Specified by:
peekin interfaceXGettingSequence<K>
-
indexOf
- Specified by:
indexOfin interfaceXGettingSequence<K>
-
indexBy
- Specified by:
indexByin interfaceXGettingSequence<K>
-
isSorted
- Specified by:
isSortedin interfaceXGettingSequence<K>
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceXGettingSequence<K>
-
lastIndexBy
- Specified by:
lastIndexByin interfaceXGettingSequence<K>
-
maxIndex
- Specified by:
maxIndexin interfaceXGettingSequence<K>
-
minIndex
- Specified by:
minIndexin interfaceXGettingSequence<K>
-
scan
Description copied from interface:XGettingSequenceIterates through the collection and returns the index of the last element that the passedPredicateapplied to ("scanning").- Specified by:
scanin interfaceXGettingSequence<K>- Returns:
- the index of the last positively tested element.
-
isEmpty
public final boolean isEmpty() -
iterator
-
size
public final long size()- Specified by:
sizein interfaceHashCollection<K>- Specified by:
sizein interfaceSized- Specified by:
sizein interfaceXGettingCollection<K>
-
toString
-
toArray
- Specified by:
toArrayin interfaceXGettingCollection<K>
-
old
- Specified by:
oldin interfaceXGettingCollection<K>
-
parent
- Specified by:
parentin interfaceXGettingMap.Satellite<K,V>- Specified by:
parentin interfaceXGettingTable.Keys<K,V>- Specified by:
parentin interfaceXGettingTable.Satellite<K,V>- Specified by:
parentin interfaceXImmutableMap.Satellite<K,V>- Specified by:
parentin interfaceXImmutableTable.Keys<K,V>
-
hashEquality
- Specified by:
hashEqualityin interfaceHashCollection<K>
-
hashDensity
public final float hashDensity()- Specified by:
hashDensityin interfaceHashCollection<K>
-