|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadOnlyCollection<T>
A contract for a collection that allows only read-only access to its contents.
This has the advantage over java.util.Collections#unmodifiableCollection()
that the compiler already complains if an invalid operation is attempted on such an
instance (as the modifying methods are not present on this interface) instead of
throwing an exception at runtime.
Method Summary | |
---|---|
T |
get(int pos)
Positional access to an item in this collection. |
boolean |
isEmpty()
Determines whether this collection is empty. |
T[] |
itemsAsArray(T[] array)
Returns an array containing all items of this instance according to the contract defined in java.util.Collection#toArray(T[] a) . |
int |
size()
Determines the number of items in this instance. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
boolean isEmpty()
int size()
T get(int pos)
pos
- the position of the item to get
T[] itemsAsArray(T[] array)
java.util.Collection#toArray(T[] a)
.
array
- the target array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |