Interface XGettingCollection<E>
- All Superinterfaces:
CapacityCarrying
,Copyable
,ExtendedCollection<E>
,Iterable<E>
,Sized
,XIterable<E>
,XJoinable<E>
- All Known Subinterfaces:
XAddGetCollection<E>
,XAddGetMap<K,V>
,XAddGetSet<E>
,XBag<E>
,XBasicEnum<E>
,XBasicList<E>
,XBasicSequence<E>
,XBasicTable<K,V>
,XBasicTable.Keys<K,V>
,XBasicTable.Values<K,V>
,XChart<K,V>
,XChart.Keys<K,V>
,XChart.Values<K,V>
,XCollection<E>
,XDecreasingEnum<E>
,XDecreasingList<E>
,XDecreasingSequence<E>
,XEnum<E>
,XGettingBag<E>
,XGettingEnum<E>
,XGettingList<E>
,XGettingMap<K,V>
,XGettingMap.Keys<K,V>
,XGettingMap.Values<K,V>
,XGettingSequence<E>
,XGettingSet<E>
,XGettingSortation<E>
,XGettingTable<K,V>
,XGettingTable.Keys<K,V>
,XGettingTable.Values<K,V>
,XImmutableBag<E>
,XImmutableCollection<E>
,XImmutableEnum<E>
,XImmutableEnum.Factory<E>
,XImmutableList<E>
,XImmutableMap<K,V>
,XImmutableMap.Keys<K,V>
,XImmutableMap.Values<K,V>
,XImmutableSequence<E>
,XImmutableSet<E>
,XImmutableTable<K,V>
,XImmutableTable.Keys<K,V>
,XImmutableTable.Values<K,V>
,XIncreasingEnum<E>
,XIncreasingList<E>
,XIncreasingSequence<E>
,XLadder<E>
,XList<E>
,XMap<K,V>
,XMap.Keys<K,V>
,XMap.Values<K,V>
,XProcessingBag<E>
,XProcessingCollection<E>
,XProcessingEnum<E>
,XProcessingList<E>
,XProcessingMap<K,V>
,XProcessingMap.Keys<K,V>
,XProcessingMap.Values<K,V>
,XProcessingSequence<E>
,XProcessingSet<E>
,XProcessingSortation<E>
,XPutGetBag<E>
,XPutGetCollection<E>
,XPutGetEnum<E>
,XPutGetList<E>
,XPutGetMap<K,V>
,XPutGetSequence<E>
,XPutGetSet<E>
,XPutGetSortation<E>
,XRank<E>
,XReference<E>
,XReferencing<E>
,XReplacingBag<E>
,XSequence<E>
,XSet<E>
,XSettingEnum<E>
,XSettingList<E>
,XSettingSequence<E>
,XSortableEnum<E>
,XSortableSequence<E>
,XSortation<E>
,XTable<K,V>
,XTable.Keys<K,V>
,XTable.Values<K,V>
- All Known Implementing Classes:
ArrayAccessor
,ArrayCollector
,ArrayView
,BulkList
,Constant
,ConstHashEnum
,ConstHashTable
,ConstHashTable.Keys
,ConstHashTable.Values
,ConstLinearEnum
,ConstList
,Empty
,EmptyTable
,EnumProcessor
,EnumView
,EqBulkList
,EqConstHashEnum
,EqConstHashTable
,EqConstHashTable.Keys
,EqConstHashTable.Values
,EqConstList
,EqHashEnum
,EqHashTable
,EqHashTable.Keys
,EqHashTable.Values
,FixedList
,HashEnum
,HashTable
,HashTable.Keys
,HashTable.Values
,LimitList
,LinkingReferencing.Default
,LinkReference.Default
,ListAccessor
,ListProcessor
,ListView
,LockedCollection
,LockedGettingMap
,LockedList
,LockedMap
,MappedList
,MapView
,MutexSet
,OpenAdressingMiniSet
,SetView
,Single
,Singleton
,SingletonView
,SubCollector
,SubList
,SubListAccessor
,SubListProcessor
,SubListView
,SubProcessor
,SubView
,SynchCollection
,SynchList
,SynchSet
,TableView
,View
public interface XGettingCollection<E> extends XIterable<E>, XJoinable<E>, ExtendedCollection<E>, Iterable<E>, CapacityCarrying, Copyable
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
XGettingCollection.Creator<E>
Nested classes/interfaces inherited from interface one.microstream.collections.types.XIterable
XIterable.Executor<E>
-
Method Summary
Modifier and Type Method Description boolean
applies(Predicate<? super E> predicate)
boolean
contains(E element)
default boolean
containsAll(XGettingCollection<? extends E> elements)
boolean
containsId(E 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 ascontainsSearched(Predicate)
with aPredicate
implementation that checks for object identity.boolean
containsSearched(Predicate<? super E> predicate)
XGettingCollection<E>
copy()
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 E>>
TcopyTo(T target)
long
count(E element)
long
countBy(Predicate<? super E> predicate)
<T extends Consumer<? super E>>
Tdistinct(T target)
<T extends Consumer<? super E>>
Tdistinct(T target, Equalator<? super E> equalator)
Equalator<? super E>
equality()
boolean
equals(Object o)
Deprecated.boolean
equals(XGettingCollection<? extends E> samples, Equalator<? super E> equalator)
Returnstrue
if the passed collection is of the same type as this collection andthis.equalsContent(list, equalator)
yieldstrue
.boolean
equalsContent(XGettingCollection<? extends E> samples, Equalator<? super E> equalator)
Returnstrue
if all elements of this list and the passed list are sequentially equal as defined by the passed equalator.<T extends Consumer<? super E>>
Texcept(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
<T extends Consumer<? super E>>
TfilterTo(T target, Predicate<? super E> predicate)
E
get()
Gets one element from the collection.int
hashCode()
Deprecated.boolean
hasVolatileElements()
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.XImmutableCollection<E>
immure()
Provides an instance of an immutable collection type with equal behavior and data as this instance.<T extends Consumer<? super E>>
Tintersect(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
default int
intSize()
Iterator<E>
iterator()
default <A> A
join(BiConsumer<? super E,? super A> joiner, A aggregate)
E
max(Comparator<? super E> comparator)
E
min(Comparator<? super E> comparator)
boolean
nullContained()
OldCollection<E>
old()
E
search(Predicate<? super E> predicate)
E
seek(E 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.long
size()
default Object[]
toArray()
default E[]
toArray(Class<E> type)
<T extends Consumer<? super E>>
Tunion(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
XGettingCollection<E>
view()
Methods inherited from interface one.microstream.collections.interfaces.CapacityCarrying
isFull, maximumCapacity, remainingCapacity
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowed
-
Method Details
-
get
E get()Gets 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.- Returns:
- the first / any element.
-
iterator
-
toArray
-
toArray
-
old
OldCollection<E> old() -
hasVolatileElements
boolean hasVolatileElements()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. Examples areWeakReference
ofSoftReference
or implementations of collection entries that remove the element contained in an entry by some means outside the collection.
Note thatWeakReference
instances 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:
hasVolatileElements
in interfaceExtendedCollection<E>
- Returns:
true
if the collection contains volatile elements.
-
size
long size() -
intSize
default int intSize() -
equality
-
equals
Returnstrue
if the passed collection is of the same type as this collection andthis.equalsContent(list, equalator)
yieldstrue
.- Parameters:
equalator
-
-
equalsContent
Returnstrue
if 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
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.- Parameters:
equalator
- the equalator to use to determine the equality of each element- Returns:
true
if this list is equal to the passed list, false otherwise
-
immure
XImmutableCollection<E> immure()Provides an instance of an immutable collection type with equal behavior and data as this instance.If this instance already is of an immutable collection type, it returns itself.
- Returns:
- an immutable copy of this collection instance.
-
view
XGettingCollection<E> view() -
copy
XGettingCollection<E> copy()Creates 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. -
nullContained
boolean nullContained() -
containsId
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 ascontainsSearched(Predicate)
with aPredicate
implementation that checks for object identity. The only difference is a performance and usability advantage- Parameters:
element
- the element to be searched in the collection by identity.- Returns:
- whether this collection contains exactely the given element.
-
contains
-
containsSearched
-
containsAll
-
applies
-
count
-
countBy
-
search
-
seek
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. (For collections using referential equality, this method is basically just a variation ofcontains(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)- Parameters:
sample
-
-
max
-
min
-
distinct
-
distinct
-
copyTo
-
filterTo
-
union
-
intersect
-
except
-
join
-
equals
Deprecated.Performs an equality comparison according to the specification inCollection
.Note that it is this interface's author opinion that the whole concept of equals() in standard Java, especially in the collection implementations, is flawed.
The reason is because all different kinds of comparison types that actually depend on the situation have to be mixed up in a harcoded fashion in one method, from identity comparison over data indentity comparison to content comparison.
In order to get the right behavior in every situation, one has to distinct between different types of equality
This means several things:
1.) You can't just say for example an ArrayList is the "same" as a LinkedList just because they contain the same content.
There are different implementations for a good reason, so you have to distinct them when comparing. There are simple code examples which create massive misbehavior that will catastrophically ruin the runtime behavior of a programm due to this error in Java / JDK / Sun / whatever.
2.) You can't always determine equality of two collections by determining equality of each element asCollection
defines it.As a conclusion: don't use this method!
Be clear what type of comparison you really need, then use one of the following methods and proper comparators:
equals(XGettingCollection,Equalator)
equalsContent(XGettingCollection,Equalator)
-
hashCode
Deprecated.
-