KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I know it's simple question, but in ArrayList<ArrayList<String>> collection; ArrayList<String> listOfSomething; collection= new ArrayList<ArrayList<String>>(); listOfSomething = new ArrayList<String>(); listOfSomething.Add("first"); listOfSomething.Add("second"); collection.Add(listOfSomething); listOfSomething.Clear(); listOfSomething.Add("first"); collection.Add(listOfSomething); I want to take String from ArrayList of ArrayList, and I don't know how to do that. For example I go ArrayList<String> myList = collection.get(0); String s = myList.get(0); and it works! but: Big update: private List<S> valuesS; private List<Z> valuesZ; ArrayList<ArrayList<String>> listOfS; ArrayList<String> listOfZ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Zdatasource = new ZDataSource(this); Zdatasource.open(); valuesZ = Zdatasource.getAllZ(); Sdatasource = new SDataSource(this); Sdatasource.open(); valuesS = Sdatasource.getAllS(); List<Map<String, String>> groupData = new ArrayList<Map<String, String>>(); List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>(); listOfS = new ArrayList<ArrayList<String>>(); listOfZ = new ArrayList<String>(); for (S i : valuesS) { // S is class for (Z j : valuesZ) { // Z is class if(j.getNumerS().equals(i.getNumerS())) { listOfZ.add(j.getNumerZ()); } else { //listOfZ.add("nothing"); } } listOfS.add(list
Tags (comma-separated)
Save Edits
Cancel