I'm trying to sort information in an ArrayList.
Basically, it removes the information if the data is >= to 0.5 (as it's faulty data)
and with all the remaining data, it sorts them in order.
How would I sort it?
I'm thinking of using some kind of recursion, creating a copy of the datalist
and then as I compare it with the original adding them, but this is just a thought...
Thanks!
private static ArrayList sortInOrder(ArrayList datalist, String url)
{
for (int i = 0; i < datalist.size(); i++)
{
SensorData data = (SensorData)datalist.get(i);
if(data.getSwellWaveHeight() >= 0.5)
{
datalist.remove(i);
}
else
{
data = datalist.sort(datalist);
}
}
return datalist;
}