Interface XRemovingCollection<E>

All Superinterfaces:
Clearable, ConsolidatableCollection, ExtendedCollection<E>, OptimizableCollection, ReleasingCollection<E>, Sized, Truncateable
All Known Subinterfaces:
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>, XLadder<E>, XList<E>, XMap<K,​V>, XMap.Keys<K,​V>, XMap.Values<K,​V>, XProcessingBag<E>, XProcessingCollection<E>, XProcessingEnum<E>, XProcessingList<E>, XProcessingMap.Keys<K,​V>, XProcessingMap.Values<K,​V>, XProcessingSequence<E>, XProcessingSet<E>, XProcessingSortation<E>, XRank<E>, XRemovingBag<E>, XRemovingEnum<E>, XRemovingList<E>, XRemovingSequence<E>, XRemovingSet<E>, XRemovingSortation<E>, XSequence<E>, XSet<E>, XSortation<E>, XTable<K,​V>, XTable.Keys<K,​V>, XTable.Values<K,​V>
All Known Implementing Classes:
ArrayCollector, BulkList, EnumProcessor, EqBulkList, EqHashEnum, EqHashTable, EqHashTable.Keys, EqHashTable.Values, HashEnum, HashTable, HashTable.Keys, HashTable.Values, LimitList, ListProcessor, LockedCollection, LockedList, LockedMap, MutexSet, OpenAdressingMiniSet, Single, SubList, SubListProcessor, SubProcessor, SynchCollection, SynchList, SynchSet

public interface XRemovingCollection<E>
extends ExtendedCollection<E>, Truncateable, ConsolidatableCollection, OptimizableCollection, ReleasingCollection<E>, Sized
  • Method Details

    • clear

      void clear()
      Clears all elements from the collection while leaving the capacity as it is.
      Specified by:
      clear in interface Clearable
    • truncate

      void truncate()
      Clears (and reinitializes if needed) this collection in the fastest possible way, i.e. by allocating a new and empty internal storage of default capacity. The collection will be empty after calling this method.
      Specified by:
      truncate in interface Truncateable
    • consolidate

      long consolidate()
      Consolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore. (e.g. WeakReference entries whose reference has been cleared).

      If this is not possible or not needed in the concrete implementation, this method does nothing and returns 0.

      Specified by:
      consolidate in interface ConsolidatableCollection
      Returns:
      the number of discarded entries.
    • optimize

      long optimize()
      Optimizes internal memory usage by rebuilding the storage to only occupy as much memory as needed to store the currently contained elements in terms of the collection's current memory usage configuration (e.g. hash density).

      If this is not possible or not needed in the concreate implementation, this method does nothing.

      Note that this method can consume a considerable amount of time depending on the implementation and should only be called intentionally and accurately when reducing occupied memory is needed.

      Specified by:
      optimize in interface OptimizableCollection
      Returns:
      the amount of elements that can be added before the internal storage has to be adjusted.
    • nullRemove

      long nullRemove()
    • removeOne

      boolean removeOne​(E element)
    • remove

      long remove​(E element)
    • removeAll

      long removeAll​(XGettingCollection<? extends E> elements)
    • retainAll

      long retainAll​(XGettingCollection<? extends E> elements)
    • removeDuplicates

      long removeDuplicates()