|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.miginfocom.property.Property<java.util.Map<K,V>>
com.miginfocom.property.MapProperty<K,V>
public class MapProperty<K,V>
| Field Summary |
|---|
| Fields inherited from class com.miginfocom.property.Property |
|---|
UNINITIALIZED |
| Constructor Summary | |
|---|---|
MapProperty()
Constructor for creating a lazy-initialized collection. |
|
MapProperty(K[] keys,
V[] values)
Constructor. |
|
MapProperty(java.util.Map<K,V> map)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
checkModifyAccess()
|
boolean |
containsKey(K key)
Returns if key is in this map. |
boolean |
containsValue(V value)
Returns if value is in this map. |
protected java.util.Map<K,V> |
create()
Creates the map. |
V |
get(K key)
Returns the value the the key points to. |
PropertyIterator<java.util.Map.Entry<K,V>> |
iterator()
Returns an iterator that iterates over this property's entries. |
java.util.Set<K> |
keySet()
Returns an, always unmodifiable, key set direct from the backing Map. |
protected java.util.Map<K,V> |
makeUnmodifiable(java.util.Map<K,V> value)
Makes the value unmodifiable, usually by wrapping it. |
Result<java.util.Map.Entry<K,V>> |
put(K key,
V value)
Associates the value with the key. |
ResultList<java.util.Map.Entry<K,V>> |
putAll(java.util.Map<? extends K,? extends V> elements)
Adds a whole map to this one. |
Result<java.util.Map.Entry<K,V>> |
remove(K key)
Removes the value that the key points to. |
ResultList<java.util.Map.Entry<K,V>> |
removeAll()
Removes all elements in this property by iterating and removing. |
int |
size()
Returns the number of elements in this property. |
java.util.Collection<V> |
values()
Returns the values from the backing Map as an unmidifiable collection. |
| Methods inherited from class com.miginfocom.property.Property |
|---|
addPropertyListener, addPropertyListener, checkInit, cloneObject, createInfo, get, getBean, getInfo, getInternal, getName, init, initNotify, isNull, removePropertyListener, set, setInternal, toString, writeReplace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MapProperty()
create() will be called
when the first real need for a collection object comes.
public MapProperty(java.util.Map<K,V> map)
map - The initial map. NOTE! The reference will be used as the backing map and
will not be cloned! May be null which is the same as calling the empty argument constructor.
public MapProperty(K[] keys,
V[] values)
keys - The keys and values that the property will be initialized with. Not null arrays.
Both keys and values can be null. Length must match.values - The keys and values that the property will be initialized with. Not null arrays.
Both keys and values can be null. Length must match.| Method Detail |
|---|
protected java.util.Map<K,V> create()
create in class Property<java.util.Map<K,V>>HashMap of default size.protected java.util.Map<K,V> makeUnmodifiable(java.util.Map<K,V> value)
PropertyTransfer.UNMODIFIABLE. Should be overridden by collection and map properties to wrap. Other property
type can also overrider this to make the value unmidifiable.
makeUnmodifiable in class Property<java.util.Map<K,V>>value - The value. May be null in which canse null should be returned.
public V get(K key)
MapPropertyI
get in interface MapPropertyI<K,V>key - The key.
public Result<java.util.Map.Entry<K,V>> put(K key,
V value)
MapPropertyI
put in interface MapPropertyI<K,V>key - The key.value - The value.
null.public ResultList<java.util.Map.Entry<K,V>> putAll(java.util.Map<? extends K,? extends V> elements)
MapPropertyI
This method iterates over the collection and adds with MapPropertyI.put(Object, Object)
putAll in interface MapPropertyI<K,V>elements - The collection which elements to add. Not null.
null.public Result<java.util.Map.Entry<K,V>> remove(K key)
MapPropertyINullPointerException if the collection
is null.
remove in interface MapPropertyI<K,V>key - The key.
null.public ResultList<java.util.Map.Entry<K,V>> removeAll()
MapPropertyI
removeAll in interface MapPropertyI<K,V>null.public java.util.Set<K> keySet()
MapPropertyI
keySet in interface MapPropertyI<K,V>null.public java.util.Collection<V> values()
MapPropertyI
values in interface MapPropertyI<K,V>null.public boolean containsKey(K key)
MapPropertyIkey is in this map. Will throw a NullPointerException if the collection
is null.
containsKey in interface MapPropertyI<K,V>key - The value to check for. May be null.
key is in this map.public boolean containsValue(V value)
MapPropertyIvalue is in this map. Will throw a NullPointerException if the collection
is null.
containsValue in interface MapPropertyI<K,V>value - The value to check for. May be null.
value is in this map.public PropertyIterator<java.util.Map.Entry<K,V>> iterator()
MapPropertyINullPointerException if the map
is null.
iterator in interface java.lang.Iterable<java.util.Map.Entry<K,V>>iterator in interface MapPropertyI<K,V>null.public int size()
MapPropertyINullPointerException if the map
is null.
size in interface MapPropertyI<K,V>protected final void checkModifyAccess()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||