Interface CapacityExtendable

All Superinterfaces:
CapacityCarrying, Sized
All Known Subinterfaces:
XAddGetCollection<E>, XAddGetMap<K,​V>, XAddGetSet<E>, XAddingBag<E>, XAddingCollection<E>, XAddingEnum<E>, XAddingList<E>, XAddingMap<K,​V>, XAddingSequence<E>, XAddingSet<E>, XAddingSortation<E>, XAddingTable<K,​V>, XBag<E>, XBasicEnum<E>, XBasicList<E>, XBasicSequence<E>, XBasicTable<K,​V>, XBasicTable.Keys<K,​V>, XChart<K,​V>, XChart.Keys<K,​V>, XCollection<E>, XEnum<E>, XExpandingEnum<E>, XExpandingList<E>, XExpandingSequence<E>, XExtendingEnum<E>, XExtendingList<E>, XExtendingSequence<E>, XIncreasingEnum<E>, XIncreasingList<E>, XIncreasingSequence<E>, XInputtingEnum<E>, XInputtingList<E>, XInputtingSequence<E>, XInsertingEnum<E>, XInsertingList<E>, XInsertingSequence<E>, XLadder<E>, XList<E>, XMap<K,​V>, XMap.Keys<K,​V>, XPrependingEnum<E>, XPrependingList<E>, XPrependingSequence<E>, XPreputtingEnum<E>, XPreputtingList<E>, XPreputtingSequence<E>, XPutGetBag<E>, XPutGetCollection<E>, XPutGetEnum<E>, XPutGetList<E>, XPutGetMap<K,​V>, XPutGetSequence<E>, XPutGetSet<E>, XPutGetSortation<E>, XPuttingBag<E>, XPuttingCollection<E>, XPuttingEnum<E>, XPuttingList<E>, XPuttingMap<K,​V>, XPuttingSequence<E>, XPuttingSet<E>, XPuttingSortation<E>, XRank<E>, XSequence<E>, XSet<E>, XSortation<E>, XTable<K,​V>, XTable.Keys<K,​V>
All Known Implementing Classes:
ArrayCollector, BulkList, Collector, EqBulkList, EqHashEnum, EqHashTable, EqHashTable.Keys, HashEnum, HashTable, HashTable.Keys, LimitList, LockedAdder, LockedCollection, LockedList, LockedMap, MutexSet, OpenAdressingMiniSet, Single, SubCollector, SubList, SynchAdder, SynchCollection, SynchList, SynchSet

public interface CapacityExtendable
extends CapacityCarrying
The capacity of a capacity carrying type (e.g. a collection) defines the amount of elements it can carry in the current state before an internal rebuild becomes necessary. The capacity can be, but does not have to be, the size of the internal storage (e.g. an array) itself. It can also be a meta value derived from the actual storage size, like "threshold" in hash collections.
  • Method Details

    • ensureCapacity

      CapacityExtendable ensureCapacity​(long minimalCapacity)
    • ensureFreeCapacity

      CapacityExtendable ensureFreeCapacity​(long minimalFreeCapacity)
      Ensures that the next minimalFreeCapacity elements can be actually added in a fast way, meaning for example no internal storage rebuild will be necessary.
      Parameters:
      minimalFreeCapacity - the capacity to ensure
      Returns:
      this
    • currentCapacity

      long currentCapacity()
      Returns the current amount of elements this instance can hold before a storage rebuild becomes necessary.

      For carrier implementations that don't have a concept of storage rebuilding (like linked list for example) this method returns the same value as CapacityCarrying.maximumCapacity().

      Returns:
      the current capacity of this instance before a rebuild is required.
    • currentFreeCapacity

      default long currentFreeCapacity()