publicclass MinMax { publicstaticvoid main(String[] args) {
Set s = new LyingSet();
s.add("x"); if (!Collections.min(s).equals("x")) thrownew RuntimeException("1: " + Collections.min(s)); if (!Collections.max(s).equals("x")) thrownew RuntimeException("2: " + Collections.max(s));
s.add("y"); if (!Collections.min(s).equals("x")) thrownew RuntimeException("3: " + Collections.min(s)); if (!Collections.max(s).equals("y")) thrownew RuntimeException("4: " + Collections.max(s));
s.add("w"); if (!Collections.min(s).equals("w")) thrownew RuntimeException("5: " + Collections.min(s)); if (!Collections.max(s).equals("y")) thrownew RuntimeException("6: " + Collections.max(s));
s.clear();
s.add("x"); if (!Collections.min(s, Collections.reverseOrder()).equals("x")) thrownew RuntimeException("1a: " + Collections.min(s)); if (!Collections.max(s, Collections.reverseOrder()).equals("x")) thrownew RuntimeException("2a: " + Collections.max(s));
s.add("y"); if (!Collections.min(s, Collections.reverseOrder()).equals("y")) thrownew RuntimeException("3a: " + Collections.min(s)); if (!Collections.max(s, Collections.reverseOrder()).equals("x")) thrownew RuntimeException("4a: " + Collections.max(s));
s.add("w"); if (!Collections.min(s, Collections.reverseOrder()).equals("y")) thrownew RuntimeException("5a: " + Collections.min(s)); if (!Collections.max(s, Collections.reverseOrder()).equals("w")) thrownew RuntimeException("6a: " + Collections.max(s));
}
}
class LyingSet extends LinkedHashSet { publicint size() { returnsuper.size() + 1; // Lies, lies, all lies!
}
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.10Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-29)
¤
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.