I know that the code sorts a list of temperatures numerically but i cant get my head round what it does in detail, as in line by line.
public void sortnumerically()
{
for (int i = 0; i < temperatures.size() - 1; i++)
{
int min = i;
for (int current = i + 1; current < temperatures.size(); current++)
{
if (temperatures.get(current) < temperatures.get(min))
{
min = current;
}
}
temperatures.set(i, temperatures.get(min));
cities.set(i, cities.get(min));
temperatures.set(min, temperatures.get(i));
cities.set(min, cities.get(i));
}