Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.util
Interface TypesafeMap<BASE>

Type Parameters:
  `BASE` - A type-checking parameter that ensures that all keys given to get, has, set, etc., are appropriate for this particular TypesafeMap.

All Known Subinterfaces:
  CoreMap

All Known Implementing Classes:
  ArrayCoreMap, CoreLabel, CyclicCoreLabel, HashableCoreMap

    public interface TypesafeMap<BASE>

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<BASE,VALUE>` Base type of keys for the map.

Method Summary
`
`<VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> boolean`
` | `containsKey(Class<KEY> key)` Returns true if contains the given key.
`
`<VALUE,KEY extends TypesafeMap.Key<BASE,VALUE>> VALUE`
` | `get(Class<KEY> key)` Returns the value associated with the given key or null if none is provided.
`
`<VALUE,KEY extends TypesafeMap.Key<BASE,VALUE>> boolean`
` | `has(Class<KEY> key)` Returns true if the map contains the given key.
`Set<Class<?>>` | `keySet()` Collection of keys currently held in this map.
`
`<VALUE,KEY extends TypesafeMap.Key<BASE,VALUE>> VALUE`
` | `remove(Class<KEY> key)` Removes the given key from the map, returning the value removed.
`
`<VALUEBASE,VALUE extends VALUEBASE,KEY extends TypesafeMap.Key<BASE,VALUEBASE>> VALUE`
` | `set(Class<KEY> 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,KEY extends TypesafeMap.Key<BASE,VALUE>> boolean has(Class<KEY> key)

  Returns true if the map contains the given key.

### get

    <VALUE,KEY extends TypesafeMap.Key<BASE,VALUE>> VALUE get(Class<KEY> key)

  Returns the value associated with the given key or null if none is provided.

### set

    <VALUEBASE,VALUE extends VALUEBASE,KEY extends TypesafeMap.Key<BASE,VALUEBASE>> VALUE set(Class<KEY> 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,KEY extends TypesafeMap.Key<BASE,VALUE>> VALUE remove(Class<KEY> key)

  Removes the given key from the map, returning the value removed.

### keySet

    Set<Class<?>> keySet()

  Collection of keys currently held in this map. Some implementations may have the returned set be immutable. As of Java 1.6 Java's generics type inference is broken enough that the proper signature for this method - Set<Class<? extends Key<BASE,?>>> - cannot be implemented by subclasses, so the return signature is not typed as strongly as it could be.

### containsKey

    <VALUE,KEY extends TypesafeMap.Key<CoreMap,VALUE>> boolean containsKey(Class<KEY> key)

  Returns true if contains the given key.

### size

    int size()

  Returns the number of keys in the map.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group