Java: Find string in array list -
my arraylist consists of array list of strings, each string inside separated commas, want split 1 of strings substrings divided commas, know how arrays using split method, im having trouble finding similar array lists, heres code:
string[] widgets2 = { "1,john,smith,john1989@gmail.com,20,88,79,59", "2,suzan,erickson,erickson_1990@gmailcom,19,91,72,85", "3,jack,napoli,the_lawyer99yahoo.com,19,85,84,87", "4,erin,black,erin.black@comcast.net,22,91,98,82", "5,adan,ramirez,networkturtle66@gmail.com,100,100,100" }; arraylist<string> jim = new arraylist<string>(arrays.aslist(widgets2)); system.out.println(jim.split(0));
it similar arrays
. implementation different. values loop through them:
list<string> jim = new arraylist<string>(arrays.aslist(widgets2)); for(string currentstring : jim){//arraylist looping string[] separatedstrings = currentstring.split(","); for(string separatedstring : separatedstrings){//now array looping //do whatever } }
if want have index , decide value get, use normal for
loop using index , use jim.get(index)
, use split()
.
having said that, stops looping through list ? it's common usage of array list - loop through :)
Comments
Post a Comment