K
- KeyV
- Valuepublic class BMap<K,V extends BValue> extends Object implements BRefType, BCollection
MapType
represents a map.Modifier and Type | Method and Description |
---|---|
void |
addNativeData(String key,
Object data)
Add natively accessible data.
|
void |
clear()
Clear map entries.
|
BValue |
copy()
Deep copy
BValue . |
V |
get(K key)
Retrieve the value for the given key from map.
|
V |
get(K key,
boolean except)
Retrieve the value for the given key from map.
|
V |
getIfExist(K key)
Retrieve the value for the given key from map.
|
LinkedHashMap<K,V> |
getMap()
Retrieve the internal map.
|
Object |
getNativeData(String key)
Get natively accessible data.
|
BType |
getType() |
boolean |
hasKey(K key)
Check existence of a key of a map.
|
boolean |
isEmpty()
Return true if this map is empty.
|
K[] |
keys()
Retrieve the keys related to this map as an array.
|
BIterator |
newIterator()
Create new Iterator for this collection.
|
void |
put(K key,
V value)
Insert a key value pair into the map.
|
boolean |
remove(K key)
Remove an item from the map.
|
int |
size()
Get the size of the map.
|
String |
stringValue() |
String |
toString() |
Object |
value() |
V[] |
values()
Retrieve the value in the map as an array.
|
public BMap()
public BMap(BType type)
public V get(K key)
key
- key used to get the valuepublic V getIfExist(K key)
BallerinaException
will be thrown if the key does not exists.key
- key used to get the valuepublic V get(K key, boolean except)
key
- key used to get the valueexcept
- flag indicating whether to throw an exception if the key does not existspublic void put(K key, V value)
key
- key related to the valuevalue
- value related to the keypublic void clear()
public boolean hasKey(K key)
key
- key of the map itempublic LinkedHashMap<K,V> getMap()
public int size()
public boolean remove(K key)
key
- key of the item to be removedpublic K[] keys()
public V[] values()
public boolean isEmpty()
public String stringValue()
stringValue
in interface BValue
public BIterator newIterator()
BCollection
newIterator
in interface BCollection
public void addNativeData(String key, Object data)
key
- key to store data withdata
- data to be storedpublic Object getNativeData(String key)
key
- key by which data was storedCopyright © 2018 WSO2. All rights reserved.