@JsType(isNative=true,
name="Map",
namespace="<global>")
public class JsMap<K,V>
extends java.lang.Object
implements JsIterable<JsMap.Entry<K,V>>
| Modifier and Type | Class and Description |
|---|---|
static class |
JsMap.Entry<K,V> |
static interface |
JsMap.ForEachCallback<V> |
static interface |
JsMap.ForEachCallback2<K,V> |
static interface |
JsMap.ForEachCallback3<K,V> |
| Constructor and Description |
|---|
JsMap()
The Map() constructor creates Map objects.
|
JsMap(JsIterable<JsMap.Entry<K,V>> pairs)
The Map() constructor creates Map objects.
|
JsMap(JsMap.Entry<K,V>... pairs)
The Map() constructor creates Map objects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
The clear() method removes all elements from a Map object.
|
boolean |
delete(K key)
The delete() method removes the specified element from a Map object.
|
JsIteratorIterable<JsMap.Entry<K,V>> |
entries()
The entries() method returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order.
|
void |
forEach(JsMap.ForEachCallback<V> forEachCallback)
The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order.
|
void |
forEach(JsMap.ForEachCallback2<K,V> forEachCallback)
The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order.
|
void |
forEach(JsMap.ForEachCallback3<K,V> forEachCallback)
The forEach() method executes a provided function once per each key/value pair in the Map object, in insertion order.
|
V |
get(K key)
The get() method returns a specified element from a Map object.
|
boolean |
has(K key)
The has() method returns a boolean indicating whether an element with the specified value exists in a Map object or not.
|
JsIteratorIterable<K> |
keys()
The keys() method returns a new Iterator object that contains the keys for each element in the Map object in insertion order.
|
JsMap<K,V> |
set(K key,
V value)
The set() method adds a new element with a specified key and value to a Map object.
|
int |
size()
The size accessor property returns the number of elements in a Map object.
|
JsIteratorIterable<V> |
values()
The values() method returns a new Iterator object that contains the values for each element in the Map object in insertion order.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waititeratorpublic JsMap()
@SafeVarargs
public JsMap(@Nonnull
JsMap.Entry<K,V>... pairs)
pairs - an array of pairs that will be added to the Map.public JsMap(@Nonnull
JsIterable<JsMap.Entry<K,V>> pairs)
pairs - an iterable containing pairs that will be added to the Map.@JsProperty(name="size") public int size()
public void clear()
public boolean delete(@Nullable
K key)
key - the key of the element to remove from the Map object.public JsIteratorIterable<JsMap.Entry<K,V>> entries()
public void forEach(@Nonnull
JsMap.ForEachCallback<V> forEachCallback)
forEachCallback - the function to execute for each element.public void forEach(@Nonnull
JsMap.ForEachCallback2<K,V> forEachCallback)
forEachCallback - the function to execute for each element.public void forEach(@Nonnull
JsMap.ForEachCallback3<K,V> forEachCallback)
forEachCallback - the function to execute for each element.public V get(K key)
key - the key of the element to return from the Map object.public boolean has(@Nullable
K key)
@Nonnull public JsIteratorIterable<K> keys()
@Nonnull public JsMap<K,V> set(@Nullable K key, @Nullable V value)
key - the key of the element to add to the Map object.value - the value of the element to add to the Map object.@Nonnull public JsIteratorIterable<V> values()