org.cruxframework.crux.core.client.collection
Class Map<V>

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by org.cruxframework.crux.core.client.collection.Map<V>
Type Parameters:
V - the type of values stored in the Map

public class Map<V>
extends com.google.gwt.core.client.JavaScriptObject

The root Map type that provides read-access to a dictionary that might still be mutable by another actor. See MutableMap for a description of the role Map#adapt(Object) plays in the behavior of this class.


Constructor Summary
protected Map()
           
 
Method Summary
 void clear()
          Removes all entries from this map.
 boolean containsKey(String key)
          Determines if a key is in the set of keys contained in the map.
 V get(String key)
          Get a value indexed by a key.
 boolean isEmpty()
          Tests whether this Map contains any element.
 Array<String> keys()
           
 void put(String key, V value)
          Put the value in the map at the given key.
 void remove(String key)
          Deletes a key-value entry if the key is a member of the key set.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Map

protected Map()
Method Detail

clear

public final void clear()
Removes all entries from this map.


containsKey

public final boolean containsKey(String key)
Determines if a key is in the set of keys contained in the map. key can take any value that allow Map#adapt(Object) to successfully complete execution.

Parameters:
key - to use for testing membership
Returns:
true if the key is contained in the map

get

public final V get(String key)
Get a value indexed by a key. Notice that if the Map contains null values, a returned null value does not guarantee that there is no such mapping. Use containsKey(K) to determine key membership. key can take any value that allow Map#adapt(Object) to successfully complete execution.

Parameters:
key - index to use for retrieval
Returns:
value associated to the key or null otherwise

isEmpty

public final boolean isEmpty()
Tests whether this Map contains any element.

Returns:
true if the map contains no entries

keys

public final Array<String> keys()
Returns:

put

public final void put(String key,
                      V value)
Put the value in the map at the given key. key must be a value accepted by the underlying adapter; that is, a call to adapt(element) produces a non-null result.

Parameters:
key - index to the value
value - value to be stored

remove

public final void remove(String key)
Deletes a key-value entry if the key is a member of the key set. key must be such that a call to adapt(element) successfully completes.

Parameters:
key - index to the key-value


Copyright © 2014. All rights reserved.