15/09/02 21:21:11.82 mYSaS8tf.net
>>488
private boolean equals(int[] indexes, String[] a, String[] b) {
for (int i : indexes) if (a[i] != b[i]) return false;
return true;
}
private void test() {
List<String[]> list = new ArrayList<String[]>();
list.add(new String[] {"a", "b", "c"});
list.add(new String[] {"a", "bb", "cc"});
list.add(new String[] {"a", "bbb", "c"});
list.add(new String[] {"a", "bbbb", "c"});
int[] indexes = new int[] {0, 2}; // 複数の特定インデックスの配列要素ってこういうこと?
for (int i = 0; i < list.size(); i++) {
for (int j = list.size() - 1; i < j; j--) {
if (equals(indexes, list.get(i), list.get(j))) list.remove(j);
}
}
for (String[] a : list) System.out.println(Arrays.toString(a));
}