net.sf.molae.pipe.basic
Class UnextendableCollection<E>
java.lang.Object
net.sf.molae.pipe.basic.ObjectProxy<B>
net.sf.molae.pipe.basic.CollectionProxy<Collection<E>,E>
net.sf.molae.pipe.basic.UnextendableCollection<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>
public final class UnextendableCollection<E>
- extends CollectionProxy<Collection<E>,E>
A wrapper around collections that prohibits adding elements.
Useful for map implementations.
Method Summary |
boolean |
add(E o)
This implementation always throws an
UnsupportedOperationException . |
boolean |
addAll(Collection<? extends E> c)
This implementation always throws an
UnsupportedOperationException . |
Methods inherited from class net.sf.molae.pipe.basic.CollectionProxy |
clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
UnextendableCollection
public UnextendableCollection(Collection<E> base)
- Constructs an UnextendableCollection object.
- Parameters:
base
- the underlying (extendable) collection
- Throws:
NullPointerException
- if the specified object is
null
.
add
public boolean add(E o)
- This implementation always throws an
UnsupportedOperationException
.
- Specified by:
add
in interface Collection<E>
- Overrides:
add
in class CollectionProxy<Collection<E>,E>
addAll
public boolean addAll(Collection<? extends E> c)
- This implementation always throws an
UnsupportedOperationException
.
- Specified by:
addAll
in interface Collection<E>
- Overrides:
addAll
in class CollectionProxy<Collection<E>,E>