Map
Keywords: weiss.util.Map interface

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

## weiss.util
Interface Map<KeyType,ValueType>

All Superinterfaces:
  java.io.Serializable

All Known Implementing Classes:
  HashMap, TreeMap

    public interface Map<KeyType,ValueType>

extends java.io.Serializable

Map interface. A map stores key/value pairs. In our implementations, duplicate keys are not allowed.

Nested Class Summary
`static interface` | `Map.Entry<KeyType,ValueType>` The interface used to access the key/value pairs in a map.

Method Summary
`void` | `clear()` Removes all key value pairs from the map.
`boolean` | `containsKey(KeyType key)` Tests if this map contains a given key.
`Set<Map.Entry<KeyType,ValueType>>` | `entrySet()` Return a set of Map.Entry objects corresponding to the key/value pairs in the map.
`ValueType` | `get(KeyType key)` Returns the value in the map associated with the key.
`boolean` | `isEmpty()` Tests if this map is empty.
`Set<KeyType>` | `keySet()` Returns the keys in the map.
`ValueType` | `put(KeyType key, ValueType value)` Adds the key value pair to the map, overriding the original value if the key was already present.
`ValueType` | `remove(KeyType key)` Remove the key and its value from the map.
`int` | `size()` Returns the number of keys in this map.
`Collection<ValueType>` | `values()` Returns the values in the map.

Method Detail

### size

    int size()

  Returns the number of keys in this map.

  Returns:
    the number of keys in this collection.

### isEmpty

    boolean isEmpty()

  Tests if this map is empty.

  Returns:
    true if the size of this map is zero.

### containsKey

    boolean containsKey(KeyType key)

  Tests if this map contains a given key.

  Parameters:
    `key` - the key to search for.
  Returns:
    true if the map contains the key.

### get

    ValueType get(KeyType key)

  Returns the value in the map associated with the key.

  Parameters:
    `key` - the key to search for.
  Returns:
    the value that matches the key or null if the key is not found. Since null values are allowed, checking if the return value is null may not be a safe way to ascertain if the key is present in the map.

### put

    ValueType put(KeyType key,
                  ValueType value)

  Adds the key value pair to the map, overriding the original value if the key was already present.

  Parameters:
    `key` - the key to insert.
    `value` - the value to insert.
  Returns:
    the old value associated with the key, or null if the key was not present prior to this call.

### remove

    ValueType remove(KeyType key)

  Remove the key and its value from the map.

  Parameters:
    `key` - the key to remove.
  Returns:
    the previous value associated with the key, or null if the key was not present prior to this call.

### clear

    void clear()

  Removes all key value pairs from the map.

### keySet

    Set<KeyType> keySet()

  Returns the keys in the map.

  Returns:
    the keys in the map.

### values

    Collection<ValueType> values()

  Returns the values in the map. There may be duplicates.

  Returns:
    the values in the map.

### entrySet

    Set<Map.Entry<KeyType,ValueType>> entrySet()

  Return a set of Map.Entry objects corresponding to the key/value pairs in the map.

  Returns:
    the key/value pairs 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