Interface XRemovingCollection<E>

    • Method Detail

      • 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)
      • removeDuplicates

        long removeDuplicates()