K - KeyV - Valuepublic class BMap<K,V extends BValue> extends BallerinaMessageDataSource implements BRefType, BCollection
MapType represents a map.| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear map entries.
|
BValue |
copy()
Deep copy
BValue. |
V |
get(K key)
Retrieve the value for the given key from map.
|
LinkedHashMap<K,V> |
getMap()
Retrieve the internal map.
|
String |
getMessageAsString()
Returns the entire message as string.
|
BType |
getType() |
boolean |
hasKey(K key)
Check existence of a key of a map.
|
boolean |
isEmpty()
Return true if this map is empty.
|
Set<K> |
keySet()
Retrieve the set of keys related to this map.
|
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.
|
void |
serializeData(OutputStream outputStream)
Serialize data in to a byte stream.
|
int |
size()
Get the size of the map.
|
String |
stringValue() |
Object |
value() |
clone, getContentType, getDataObject, getValue, getValueAsString, getValueAsString, setContentTypepublic BMap()
public BMap(BMapType type)
public V get(K key)
key - key used to get the valuepublic 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 Set<K> keySet()
public boolean isEmpty()
public String stringValue()
stringValue in interface BValuepublic String getMessageAsString()
MessageDataSourcegetMessageAsString in interface MessageDataSourcegetMessageAsString in class BallerinaMessageDataSourcepublic void serializeData(OutputStream outputStream)
MessageDataSourceserializeData in interface MessageDataSourceserializeData in class BallerinaMessageDataSourcepublic BIterator newIterator()
BCollectionnewIterator in interface BCollectionCopyright © 2018 WSO2. All rights reserved.