Using .split() on an ArrayList of strings

13 Views Asked by At

I have an array list that is filled with coordinates. Right now, the coordinates are stored in pairs and are seperated by a space. I hope to use the .split(" ") method on each element of the ArrayList and then load each individual coordinate into its respective longitude/latitude array list. I am just not sure how to iterate through and use the .split() method on this ArrayList. Any help would be much appreciated.

An example of one of the elements in the ArrayList would be: 91.826461 86.019730 (These are just random numbers I came up with as an example)

The 91.626461 is the longitude, the 86.019730 is the latittude. The space in the middle is what I am going to split them by. Essentially, I think I just need help iterating through the ArrayList and applying the .split() function which is what I'm not sure how to do exactly.

0

There are 0 best solutions below