Reputation:
How to pass an argument into method when is in map?
I'm trying to create excel file with dynamic values from table. In map I have some references to records in table like BOM.BOMid and I want to pass this like an argument to this function not like str:
Map map = new Map(Types::Integer, Types::Container);
MapEnumerator en = new MapEnumerator(map);
map.insert(1, bom.ItemId);
xlsWorkSheet.cells().item(row,column).value(<value from map>);column++;
Upvotes: 0
Views: 2510
Reputation: 6696
If you used map.insert(1, bom.ItemId);
to add an element to the map, you can retrieve the value as follows:
Map map = new Map(Types::Integer, Types::String);
ItemId value;
...
if (map.exists(1))
{
value = map.lookup(1);
}
You can also make use of MapEnumerator
as follows:
//int key;
...
MapEnumerator en = map.getEnumerator();
while (enum.moveNext())
{
//key = enum.currentKey();
value = enum.currentValue();
...
}
Upvotes: 4