i have this function below which takes in a arraylist of Strings and return a LinkedHashMap. I plan to use this linkedhashmap to write into a textfile subsequently.
public Map<String,String> convertMap(ArrayList<String> Data){
Map<String,String> myLinkedHashMap = new LinkedHashMap<String, String>();
myLinkedHashMap.put("1", "first");
myLinkedHashMap.put("2", "second");
myLinkedHashMap.put("3", "third");
return myLinkedHashMap;
}
I am stucked on getting out the respective information from the ArrayList Data in order to use the put method to insert it into a linkedhashmap.
Lets say Arraylist Data contains: Name: John Age: 20 Gender: Male
I wan to replace 'Name' at the "1" Column , and 'John' at the "First" Column.
Can anyone kindly guide me on this issue ?