publicclass NullComparator { publicstaticvoid main(String[] args) throws Exception {
List list = new ArrayList(100); for (int i=0; i<100; i++)
list.add(new Integer(i));
List sorted = new ArrayList(list);
Collections.shuffle(list);
Object[] a = list.toArray();
Arrays.sort(a, null); if (!Arrays.asList(a).equals(sorted)) thrownew Exception("Arrays.sort");
a = list.toArray();
Arrays.sort(a, 0, 100, null); if (!Arrays.asList(a).equals(sorted)) thrownew Exception("Arrays.sort(from, to)"); if (Arrays.binarySearch(a, new Integer(69)) != 69) thrownew Exception("Arrays.binarySearch");
List tmp = new ArrayList(list);
Collections.sort(tmp, null); if (!tmp.equals(sorted)) thrownew Exception("Collections.sort"); if (Collections.binarySearch(tmp, new Integer(69)) != 69) thrownew Exception("Collections.binarySearch"); if (!Collections.min(list, null).equals(new Integer(0))) thrownew Exception("Collections.min"); if (!Collections.max(list, null).equals(new Integer(99))) thrownew Exception("Collections.max");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.