|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections.map.AbstractMapDecorator<K,V>
org.apache.commons.collections.map.FixedSizeMap<K,V>
public class FixedSizeMap<K,V>
Decorates another Map
to fix the size, preventing add/remove.
Any action that would change the size of the map is disallowed. The put method is allowed to change the value associated with an existing key however.
If trying to remove or clear the map, an UnsupportedOperationException is thrown. If trying to put a new mapping into the map, an IllegalArgumentException is thrown. This is because the put method can succeed if the mapping's key already exists in the map, so the put method is not always unsupported.
This class is Serializable from Commons Collections 3.1.
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.map.AbstractMapDecorator |
---|
map |
Constructor Summary | |
---|---|
protected |
FixedSizeMap(Map<K,V> map)
Constructor that wraps (not copies). |
Method Summary | ||
---|---|---|
void |
clear()
|
|
static
|
decorate(Map<K,V> map)
Factory method to create a fixed size map. |
|
Set<Map.Entry<K,V>> |
entrySet()
|
|
boolean |
isFull()
Returns true if this map is full and no new elements can be added. |
|
Set<K> |
keySet()
|
|
int |
maxSize()
Gets the maximum size of the map (the bound). |
|
V |
put(K key,
V value)
|
|
void |
putAll(Map<? extends K,? extends V> mapToCopy)
|
|
V |
remove(Object key)
|
|
Collection<V> |
values()
|
Methods inherited from class org.apache.commons.collections.map.AbstractMapDecorator |
---|
containsKey, containsValue, equals, get, getMap, hashCode, isEmpty, size, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected FixedSizeMap(Map<K,V> map)
map
- the map to decorate, must not be null
IllegalArgumentException
- if map is nullMethod Detail |
---|
public static <K,V> Map<K,V> decorate(Map<K,V> map)
map
- the map to decorate, must not be null
IllegalArgumentException
- if map is nullpublic V put(K key, V value)
put
in interface Map<K,V>
put
in class AbstractMapDecorator<K,V>
public void putAll(Map<? extends K,? extends V> mapToCopy)
putAll
in interface Map<K,V>
putAll
in class AbstractMapDecorator<K,V>
public void clear()
clear
in interface Map<K,V>
clear
in class AbstractMapDecorator<K,V>
public V remove(Object key)
remove
in interface Map<K,V>
remove
in class AbstractMapDecorator<K,V>
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
entrySet
in class AbstractMapDecorator<K,V>
public Set<K> keySet()
keySet
in interface Map<K,V>
keySet
in class AbstractMapDecorator<K,V>
public Collection<V> values()
values
in interface Map<K,V>
values
in class AbstractMapDecorator<K,V>
public boolean isFull()
BoundedMap
isFull
in interface BoundedMap<K,V>
true
if the map is fullpublic int maxSize()
BoundedMap
maxSize
in interface BoundedMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |