com.koloboke.collect
Interface Container

All Known Subinterfaces:
ByteByteMap, ByteCharMap, ByteCollection, ByteDoubleMap, ByteFloatMap, ByteIntMap, ByteLongMap, ByteObjMap<V>, ByteSet, ByteShortMap, CharByteMap, CharCharMap, CharCollection, CharDoubleMap, CharFloatMap, CharIntMap, CharLongMap, CharObjMap<V>, CharSet, CharShortMap, DoubleByteMap, DoubleCharMap, DoubleCollection, DoubleDoubleMap, DoubleFloatMap, DoubleIntMap, DoubleLongMap, DoubleObjMap<V>, DoubleSet, DoubleShortMap, FloatByteMap, FloatCharMap, FloatCollection, FloatDoubleMap, FloatFloatMap, FloatIntMap, FloatLongMap, FloatObjMap<V>, FloatSet, FloatShortMap, HashByteByteMap, HashByteCharMap, HashByteDoubleMap, HashByteFloatMap, HashByteIntMap, HashByteLongMap, HashByteObjMap<V>, HashByteSet, HashByteShortMap, HashCharByteMap, HashCharCharMap, HashCharDoubleMap, HashCharFloatMap, HashCharIntMap, HashCharLongMap, HashCharObjMap<V>, HashCharSet, HashCharShortMap, HashContainer, HashDoubleByteMap, HashDoubleCharMap, HashDoubleDoubleMap, HashDoubleFloatMap, HashDoubleIntMap, HashDoubleLongMap, HashDoubleObjMap<V>, HashDoubleSet, HashDoubleShortMap, HashFloatByteMap, HashFloatCharMap, HashFloatDoubleMap, HashFloatFloatMap, HashFloatIntMap, HashFloatLongMap, HashFloatObjMap<V>, HashFloatSet, HashFloatShortMap, HashIntByteMap, HashIntCharMap, HashIntDoubleMap, HashIntFloatMap, HashIntIntMap, HashIntLongMap, HashIntObjMap<V>, HashIntSet, HashIntShortMap, HashLongByteMap, HashLongCharMap, HashLongDoubleMap, HashLongFloatMap, HashLongIntMap, HashLongLongMap, HashLongObjMap<V>, HashLongSet, HashLongShortMap, HashObjByteMap<K>, HashObjCharMap<K>, HashObjDoubleMap<K>, HashObjFloatMap<K>, HashObjIntMap<K>, HashObjLongMap<K>, HashObjObjMap<K,V>, HashObjSet<E>, HashObjShortMap<K>, HashShortByteMap, HashShortCharMap, HashShortDoubleMap, HashShortFloatMap, HashShortIntMap, HashShortLongMap, HashShortObjMap<V>, HashShortSet, HashShortShortMap, IntByteMap, IntCharMap, IntCollection, IntDoubleMap, IntFloatMap, IntIntMap, IntLongMap, IntObjMap<V>, IntSet, IntShortMap, LongByteMap, LongCharMap, LongCollection, LongDoubleMap, LongFloatMap, LongIntMap, LongLongMap, LongObjMap<V>, LongSet, LongShortMap, ObjByteMap<K>, ObjCharMap<K>, ObjCollection<E>, ObjDoubleMap<K>, ObjFloatMap<K>, ObjIntMap<K>, ObjLongMap<K>, ObjObjMap<K,V>, ObjSet<E>, ObjShortMap<K>, ShortByteMap, ShortCharMap, ShortCollection, ShortDoubleMap, ShortFloatMap, ShortIntMap, ShortLongMap, ShortObjMap<V>, ShortSet, ShortShortMap

public interface Container

The root interface of all collections within the library.

Methods ensureCapacity(long) and shrink() make sense only for array-based containers.

Mutability matrix

This matrix shows which methods of this interface are supported by containers with different mutability profiles.
Method \ MutabilityMutableUpdatableImmutable
size()
sizeAsLong()
isEmpty()
ensureCapacity(long)-
shrink() -
clear() -


Method Summary
 void clear()
          Removes all of the elements (entries) from this container.
 boolean ensureCapacity(long minSize)
          Prepares the container for insertion of minSize - sizeAsLong() new elements without excessive capacity increases.
 boolean isEmpty()
          Returns true if this container contains no elements.
 boolean shrink()
          Decreases this container's capacity, if there is memory overuse.
 int size()
          Returns the number of elements (entries) in this container.
 long sizeAsLong()
          Returns the number of elements (entries) in this container.
 

Method Detail

size

int size()
Returns the number of elements (entries) in this container. If this container contains more than Integer.MAX_VALUE elements (entries), returns Integer.MAX_VALUE.

Returns:
the number of elements (entries) in this container
See Also:
sizeAsLong()

sizeAsLong

long sizeAsLong()
Returns the number of elements (entries) in this container.

Returns:
the number of elements (entries) in this container

ensureCapacity

boolean ensureCapacity(long minSize)
Prepares the container for insertion of minSize - sizeAsLong() new elements without excessive capacity increases.

If the container is an array-based data structure, increases the capacity of this container, if necessary, to ensure that it can hold at least minSize elements. Returns true, if the capacity has been increased, false if it isn't necessary.

If the container is a linked data structure, does nothing and returns false.

Parameters:
minSize - the desired minimum size, which the container is expected to reach soon
Returns:
true if the capacity has been increased, false if it isn't necessary or impossible
Throws:
UnsupportedOperationException - if the container doesn't support insertions

shrink

boolean shrink()
Decreases this container's capacity, if there is memory overuse.

If the container is array-based data structure, and the memory is overused due to preventive expansion on elements insertion, decreases the capacity and returns true, returns false if the capacity is already minimum needed to hold the current number of elements.

If the container is linked data structure, does nothing and returns false.

Returns:
true if the container has been actually shrunk, false otherwise
Throws:
UnsupportedOperationException - if the container is immutable

clear

void clear()
Removes all of the elements (entries) from this container. The container will be empty after this method returns.

Throws:
UnsupportedOperationException - if the container is immutable

isEmpty

boolean isEmpty()
Returns true if this container contains no elements.

Returns:
true if this container contains no elements