|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadOnlySet<T>
A contract for a set that allows only read-only access to its contents.
This has the advantage over java.util.Collections#unmodifiableSet()
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 | |
---|---|
boolean |
contains(Object obj)
Returns true if this set contains the specified element. |
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) . |
Iterator<T> |
iterator()
Returns an iterator over the elements in this set. |
int |
size()
Determines the number of items in this instance. |
Method Detail |
---|
boolean isEmpty()
int size()
boolean contains(Object obj)
obj
- element whose presence in this set is to be tested
Iterator<T> iterator()
iterator
in interface Iterable<T>
T[] itemsAsArray(T[] array)
java.util.Collection#toArray(T[] a)
.
array
- the target array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |