I have created the data structure that is google based guava table and it is shown below
final Table<String, String, List<String>> values = HashBasedTable.create();
values.put("ton bon", "currency", Lists.newArrayList("ccdd", "rode1", "cwey", "Certy"));
values.put("ton bon", "racy", Lists.newArrayList("wqadd", "werde", "ihtr", "ytre"));
Below is the way in which i am iterating over this collection
Map<String, List<String>> fmap = new HashMap<String, List<String>>();
List<String> validColumnKeys = Arrays.asList("ccdd", "rode1", "cwey", "Certy");
Map<String, List<String>> row = values.row("ton bon");
for (String columnKey : validColumnKeys) {
fmap.put(columnKey, row.get(columnKey));
}
Now i want to modify my condition in such a way that if the row key contains the value of ton bon and the column key contains these values "ccdd","rode1","cwey","Certy"
then it should fill the map
named fmap
as shown below and similarly for the second condition too.
The map i want :
Key Value
ccdd currency
rode1 currency
cwey currency
Certy currency
wqadd racy
werde racy
ihtr racy
ytre racy
But unfortunately the code I have tried is not working. Please advise what went wrong and how can I overcome from this.
It Should be a loop inside loop for column and row
will print
The values can be stored in fmap.put(rowValue, columnKey);.....Note: here the key should be unique
The optimized method is