I have 2 lists that I send to MySql.
public ArrayList<Double> lat = new ArrayList<Double>();
public int l = lat.size();
public ArrayList<Double> lng = new ArrayList<Double>();
public int ll = lng.size();
Double l = lat.get(i);
Double ll = lng.get(i);
String sql = "INSERT INTO tab (lat, lng) VALUES('" + l + "', '" + ll + "')";
stmt.executeUpdate(sql);
but in the wrong order, so I put the
Collections.reverse(lat);
Collections.reverse(lng);
before
Double l = lat.get(i);
Double ll = lng.get(i);
and everything works in good order, but when I use this method again with this same elements in list the order will be reversed again ...
Adding elements to the list:
lat.add(l, currentLatitude);
lng.add(ll, currentLongitude);
How to do, that elements were in good order all the time?