I am adding the following to the HashMap collection after each row in the UI form
Declaration
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> valSetOne = new ArrayList<String>();
valSetOne.add("Orange");
valSetOne.add("Apple");
map.put("A1", valSetOne);
If you need performance with respect to checking if a value exists and dont care about the order in each row, you can use Set interface and use a HashSet instead of List
Map<String, Set<String>> map = new HashMap<String, Set<String>>();
Set<String> valSetOne = new HashSet<String>();
To check, use
Set<String> set= map.get("A1");//returns null if key does not exists(you also use containsKey() to check if key exists)
set.contains("value")
If you dont need performance, u can just use
List<String> valSetOne = new ArrayList<String>();
List<String> list = map.get("A1");//returns null if key does not exists(you also use containsKey() to check if key exists )
list .contains("value") to check if it exists