java - How to split element in an ArrayList in multidimensional arrayList -


i have following:

[[statistics (ph)], [ upright normal recumbent normal total]] 

i want split first element of second element on whitespace end with:

[[statistics (ph)], [upright,normal,recumbent,normal,total]] 

my code far:

for (arraylist<list<string>> row2 : statsph) { row2.get(1).get(0).split("\\s"); } 

but nothing happens

java strings are immutable, need store return value of split("\\s") in correct list.

i recommend like

for (arraylist<list<string>> row2 : statsph) {     list<string> stats = row2.get(1);      // remove() returns object removed     string allstats = stats.remove(0);      collections.addall(stats, allstats.split("\\s")); } 

note we're removing original string first, adding of 'split' values.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -