edu.stanford.nlp.util
Interface TypesafeMap

All Known Subinterfaces:
CoreMap
All Known Implementing Classes:
ArrayCoreMap, CoreLabel, HashableCoreMap

public interface TypesafeMap

Type signature for a class that supports the basic operations required of a typesafe heterogeneous map.

Author:
dramage

Nested Class Summary
static interface TypesafeMap.Key<VALUE>
          Base type of keys for the map.
 
Method Summary
<VALUE> boolean
containsKey(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
          Returns true if contains the given key.
<VALUE> VALUE
get(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
          Returns the value associated with the given key or null if none is provided.
<VALUE> boolean
has(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
          Returns true if the map contains the given key.
 java.util.Set<java.lang.Class<?>> keySet()
          Collection of keys currently held in this map.
<VALUE> VALUE
remove(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
          Removes the given key from the map, returning the value removed.
<VALUE> VALUE
set(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key, VALUE value)
          Associates the given value with the given type for future calls to get.
 int size()
          Returns the number of keys in the map.
 

Method Detail

has

<VALUE> boolean has(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
Returns true if the map contains the given key.


get

<VALUE> VALUE get(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
Returns the value associated with the given key or null if none is provided.


set

<VALUE> VALUE set(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key,
                  VALUE value)
Associates the given value with the given type for future calls to get. Returns the value removed or null if no value was present.


remove

<VALUE> VALUE remove(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
Removes the given key from the map, returning the value removed.


keySet

java.util.Set<java.lang.Class<?>> keySet()
Collection of keys currently held in this map. Some implementations may have the returned set be immutable.


containsKey

<VALUE> boolean containsKey(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key)
Returns true if contains the given key.


size

int size()
Returns the number of keys in the map.



Stanford NLP Group