I'm building a multidimensional array of Objects, and I would want to sort it by a specific element inside the sub-arrays.
I tried Collections.sort and a bubbleSort but they didn't work.
Object[][] fields = {{
"sam", "mccarty",
"m", "1988/06/01", 5.0, true
},
{
"tom", "huges",
"m", "1988/06/01", 7.0, true
},
{
"jim", "ross",
"m", "1988/06/01", 6.5, true
}
};
I expect the array sorted by sub-element [4], so:
{
{
"tom", "huges",
"m", "1988/06/01", 7.0, true
},
{
"jim", "ross",
"m", "1988/06/01", 6.0, true
},
{
"sam", "mccartney",
"m", "1988/06/01", 5.5, true
}
}