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
  • Method Details

    • get

      E get()
      Gets one element from the collection. If the collection is not ordered XGettingSequence, then it is undefined which element is returned. If the collection is ordered, the element at index 0 is returned.
      the first / any element.
    • iterator

      Iterator<E> iterator()
      Specified by:
      iterator in interface Iterable<E>
    • toArray

      default Object[] toArray()
    • toArray

      default E[] toArray​(Class<E> type)
    • 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 are WeakReference of SoftReference or implementations of collection entries that remove the element contained in an entry by some means outside the collection.
      Note that WeakReference 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 interface ExtendedCollection<E>
      true if the collection contains volatile elements.
    • size

      long size()
      Specified by:
      size in interface Sized
    • intSize

      default int intSize()
    • equality

      Equalator<? super E> equality()
    • equals

      boolean equals​(XGettingCollection<? extends E> samples, Equalator<? super E> equalator)
      Returns true if the passed collection is of the same type as this collection andthis.equalsContent(list, equalator) yields true.
      equalator -
    • equalsContent

      boolean equalsContent​(XGettingCollection<? extends E> samples, Equalator<? super E> equalator)
      Returns true 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 in Collection). The core problem of comparing collections that have no defined order is that they aren't really reliably comparable to any other collection.

      equalator - the equalator to use to determine the equality of each element
      true if this list is equal to the passed list, false otherwise
    • 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.

      an immutable copy of this collection instance.
    • view

    • 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.
      Specified by:
      copy in interface Copyable
      a copy of this list
    • nullContained

      boolean nullContained()
    • containsId

      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 as containsSearched(Predicate) with a Predicate implementation that checks for object identity. The only difference is a performance and usability advantage
      element - the element to be searched in the collection by identity.
      whether this collection contains exactely the given element.
    • contains

      boolean contains​(E element)
    • containsSearched

      boolean containsSearched​(Predicate<? super E> predicate)
    • containsAll

      default boolean containsAll​(XGettingCollection<? extends E> elements)
    • applies

      boolean applies​(Predicate<? super E> predicate)
    • count

      long count​(E element)
    • countBy

      long countBy​(Predicate<? super E> predicate)
    • search

      E search​(Predicate<? super E> predicate)
    • seek

      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. (For collections using referential equality, this method is basically just a variation of 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)
      sample -
    • max

      E max​(Comparator<? super E> comparator)
    • min

      E min​(Comparator<? super E> comparator)
    • distinct

      <T extends Consumer<? super E>> T distinct​(T target)
    • distinct

      <T extends Consumer<? super E>> T distinct​(T target, Equalator<? super E> equalator)
    • copyTo

      <T extends Consumer<? super E>> T copyTo​(T target)
    • filterTo

      <T extends Consumer<? super E>> T filterTo​(T target, Predicate<? super E> predicate)
    • union

      <T extends Consumer<? super E>> T union​(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
    • intersect

      <T extends Consumer<? super E>> T intersect​(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
    • except

      <T extends Consumer<? super E>> T except​(XGettingCollection<? extends E> other, Equalator<? super E> equalator, T target)
    • join

      default <A> A join​(BiConsumer<? super E,​? super A> joiner, A aggregate)
      Specified by:
      join in interface XJoinable<E>
    • equals

      @Deprecated boolean equals​(Object o)
      Performs an equality comparison according to the specification in Collection.

      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 as Collection 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 in class Object
      o -
    • hashCode

      @Deprecated int hashCode()
      hashCode in class Object