So, the array will be of the format:
String[][] resultsArray = new String[][] {
{ X, Y, "2014-10-22 12:00", Z},
{ X, Y, "2014-10-24 12:00", Z},
{ X, Y, "2014-10-26 12:00", Z},
};
From this I need to retrieve the earliest date.
I already have a loop for another purpose that is looping through each item in the array, so I intend to reuse it. It is in the format:
for (int i=0; i < resultsArray.length; i++) {
result += resultsArray[i][1] + "text" + resultArray[i][2];
}
My current thinking is to add the date value from the array into a new array (dateArray) on each iteration, then call Arrays.sort(dateArray)
and grab dateArray[0]
.
However, this seems pretty inefficient and clumsy, and I suspect I'm missing some simple trick.