org.joda.primitives
Interface PrimitiveCollectable<E>

All Known Subinterfaces:
BooleanCollection, BooleanList, ByteCollection, ByteList, CharCollection, CharList, DoubleCollection, DoubleList, FloatCollection, FloatList, IntCollection, IntList, LongCollection, LongList, PrimitiveCollection<E>, PrimitiveList<E>, ShortCollection, ShortList
All Known Implementing Classes:
AbstractBooleanCollection, AbstractBooleanList, AbstractByteCollection, AbstractByteList, AbstractCharCollection, AbstractCharList, AbstractDoubleCollection, AbstractDoubleList, AbstractFloatCollection, AbstractFloatList, AbstractIntCollection, AbstractIntList, AbstractLongCollection, AbstractLongList, AbstractPrimitiveCollectable, AbstractShortCollection, AbstractShortList, ArrayBooleanCollection, ArrayBooleanList, ArrayByteCollection, ArrayByteList, ArrayCharCollection, ArrayCharList, ArrayDoubleCollection, ArrayDoubleList, ArrayFloatCollection, ArrayFloatList, ArrayIntCollection, ArrayIntList, ArrayLongCollection, ArrayLongList, ArrayShortCollection, ArrayShortList, ImmutableArrayBooleanList, ImmutableArrayByteList, ImmutableArrayCharList, ImmutableArrayDoubleList, ImmutableArrayFloatList, ImmutableArrayIntList, ImmutableArrayLongList, ImmutableArrayShortList, StringBufferCharList, StringCharList

public interface PrimitiveCollectable<E>

Interface that is shared between Collection and Map implementations.

Since:
1.0
Version:
$Id: PrimitiveCollectable.java,v 1.4 2006/03/27 22:42:11 scolebourne Exp $
Author:
Stephen Colebourne

Method Summary
 void clear()
          Clears the collection/map of all elements (optional operation).
 Object clone()
          Clones the object, returning an independent copy.
 boolean isEmpty()
          Checks whether the collection/map currently has no elements.
 boolean isModifiable()
          Checks whether the collection/map can currently be modified.
 void optimize()
          Optimizes the implementation after initialization.
 int size()
          Gets the number of elements in this collection/map.
 

Method Detail

size

int size()
Gets the number of elements in this collection/map.

If this collection contains more than Integer.MAX_VALUE elements, Integer.MAX_VALUE is returned.

Returns:
the size of the collection/map

isEmpty

boolean isEmpty()
Checks whether the collection/map currently has no elements.

Returns:
true if has a size of zero

optimize

void optimize()
Optimizes the implementation after initialization.

The exact nature of the optimization is undefined and is implementation specific. A standard optimization is to trim the internal storage array to the size. An implementation may choose to do nothing, but it should NOT throw an UnsupportedOperationException.


isModifiable

boolean isModifiable()
Checks whether the collection/map can currently be modified.

Returns:
true if the collection/map allows some kind of modification

clone

Object clone()
Clones the object, returning an independent copy.

If the implementation is immutable, the object may be returned unaltered.

Returns:
a newly cloned object, not null

clear

void clear()
Clears the collection/map of all elements (optional operation).

The collection/map will have a zero size after this method completes. This method is optional, throwing an UnsupportedOperationException if the collection/map cannot be cleared.

Throws:
UnsupportedOperationException - if method not supported by this collection


Copyright © 2005-2010 Joda.org. All Rights Reserved.