Oppure ancora:
codice:
package prova;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
public class Esempio {
public static void main(String[] args) {
Object[][] A1 = { { 1, 5, 9 }, { 4, 6, 10 }, { 3, 0, 9 } };
Object[][] A2 = { { 0, 9, 9 }, { 2, 1, 10 } };
TreeMap<Object, Object[]> tm = new TreeMap<Object, Object[]>();
tm.put(A1[0][0], A1[0]);
tm.put(A1[1][0], A1[1]);
tm.put(A1[2][0], A1[2]);
tm.put(A2[0][0], A2[0]);
tm.put(A2[1][0], A2[1]);
Set<Map.Entry<Object, Object[]>> set = tm.entrySet();
int m = set.size();
Object[][] B = new Object[m][];
int j = 0;
for (Map.Entry<Object, Object[]> me : set) {
B[j] = new Object[me.getValue().length];
B[j] = me.getValue();
j++;
}
System.out.println("Verifica: "+B[3][2]);
}
}
Si può fare di meglio?