Package org.apache.pivot.wtk
Class ApplicationContext.ResourceCacheDictionary
- java.lang.Object
-
- org.apache.pivot.wtk.ApplicationContext.ResourceCacheDictionary
-
- All Implemented Interfaces:
java.lang.Iterable<java.net.URL>
,Dictionary<java.net.URL,java.lang.Object>
- Enclosing class:
- ApplicationContext
public static final class ApplicationContext.ResourceCacheDictionary extends java.lang.Object implements Dictionary<java.net.URL,java.lang.Object>, java.lang.Iterable<java.net.URL>
Resource cache dictionary implementation.Note that this implementation does not have a way to limit the number of elements it contains, so the cache continues to grow. To keep it small you have to manually remove old elements from it when they are no longer necessary.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary
Dictionary.Pair<K,V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(java.net.URL key)
Tests the existence of a key in the dictionary.java.lang.Object
get(java.net.URL key)
Retrieves the value for the given key.int
getCount()
java.util.Iterator<java.net.URL>
iterator()
java.lang.Object
put(java.net.URL key, java.lang.Object value)
Sets the value of the given key, creating a new entry or replacing the existing value.java.lang.Object
remove(java.net.URL key)
Removes a key/value pair from the map.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.collections.Dictionary
containsAny, copy, getBoolean, getBoolean, getColor, getFirst, getFont, getInt, getInt, getString, getString, putAll
-
-
-
-
Method Detail
-
get
public java.lang.Object get(java.net.URL key)
Description copied from interface:Dictionary
Retrieves the value for the given key.- Specified by:
get
in interfaceDictionary<java.net.URL,java.lang.Object>
- Parameters:
key
- The key whose value is to be returned.- Returns:
- The value corresponding to
key
, or null if the key does not exist. Will also return null if the key refers to a null value. UseDictionary.containsKey(K)
to distinguish between these two cases.
-
put
public java.lang.Object put(java.net.URL key, java.lang.Object value)
Description copied from interface:Dictionary
Sets the value of the given key, creating a new entry or replacing the existing value.- Specified by:
put
in interfaceDictionary<java.net.URL,java.lang.Object>
- Parameters:
key
- The key whose value is to be set.value
- The value to be associated with the given key.- Returns:
- The value previously associated with the key.
-
remove
public java.lang.Object remove(java.net.URL key)
Description copied from interface:Dictionary
Removes a key/value pair from the map.- Specified by:
remove
in interfaceDictionary<java.net.URL,java.lang.Object>
- Parameters:
key
- The key whose mapping is to be removed.- Returns:
- The value that was removed.
-
containsKey
public boolean containsKey(java.net.URL key)
Description copied from interface:Dictionary
Tests the existence of a key in the dictionary.- Specified by:
containsKey
in interfaceDictionary<java.net.URL,java.lang.Object>
- Parameters:
key
- The key whose presence in the dictionary is to be tested.- Returns:
true
if the key exists in the dictionary;false
, otherwise.
-
iterator
public java.util.Iterator<java.net.URL> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.net.URL>
-
getCount
public int getCount()
-
-