You can make something like this using HashMap, this way:
public static void addSortListItem(int group_id) {
//Create a HashMap to storage your lists
HashMap<String, ArrayList<ExpListObject>> mapList = new HashMap<String, ArrayList<ExpListObject>>();
ArrayList<Object> array = mapList.get(String.valueOf(group_id));
if (array != null) {
array.add(new ExpListObject());
} else {
// Insert the new Array into the HashMap
mapList.put(String.valueOf(group_id), new ArrayList<ExpListObject>());
}
}
Or this way:
public static void addSortListItem(int group_id) {
//Create a HashMap to storage your lists
HashMap< Integer, ArrayList<ExpListObject>> mapList = new HashMap< Integer, ArrayList<ExpListObject>>();
ArrayList<Object> array = mapList.get(group_id);
if (array != null) {
array.add(new ExpListObject());
} else {
// Insert the new Array into the HashMap
mapList.put(group_id, new ArrayList<ExpListObject>());
}
}