@Test public void testComparator() { Sender copy = new Sender(sender); assertEquals(0, Sender.comparatorByColumn("Rolle").compare(sender, copy)); copy.overridenValues.put("Rolle", "a"); assertTrue(Sender.comparatorByColumn("Rolle").compare(sender, copy) > 0); copy.overridenValues.put("Rolle", "z"); assertTrue(Sender.comparatorByColumn("Rolle").compare(sender, copy) < 0); copy.overridenValues.put("Rolle", null); assertTrue(Sender.comparatorByColumn("Rolle").compare(sender, copy) < 0); sender.overridenValues.put("Nachname", null); assertTrue(Sender.comparatorByColumn("Nachname").compare(sender, copy) > 0); copy.overridenValues.put("Nachname", null); assertEquals(0, Sender.comparatorByColumn("Nachname").compare(sender, copy)); }
public static Comparator<Sender> comparatorByColumn(String column) { Comparator<String> nullLast = Comparator.nullsLast(String::compareTo); return Comparator.comparing(s -> s.get(column), nullLast); }
Sender { public static Comparator<Sender> comparatorByColumn(String column) { Comparator<String> nullLast = Comparator.nullsLast(String::compareTo); return Comparator.comparing(s -> s.get(column), nullLast); } }
Sender { public static Comparator<Sender> comparatorByColumn(String column) { Comparator<String> nullLast = Comparator.nullsLast(String::compareTo); return Comparator.comparing(s -> s.get(column), nullLast); } Sender(Dataset dataset);  Sender(Map<String, String> dsoverride);  Sender(String key, Dataset dataset, Map<String, String> dsoverride);  Sender(Sender copy); }
Sender { public static Comparator<Sender> comparatorByColumn(String column) { Comparator<String> nullLast = Comparator.nullsLast(String::compareTo); return Comparator.comparing(s -> s.get(column), nullLast); } Sender(Dataset dataset);  Sender(Map<String, String> dsoverride);  Sender(String key, Dataset dataset, Map<String, String> dsoverride);  Sender(Sender copy); String getKey(); Dataset getDataset(); Map<String, String> getOverridenValues(); boolean isSelected(); void setSelected(boolean selected); String get(String columnName); String getFromDatabase(String columnName); void overrideValue(String columnName, String newValue); boolean isFromDatabase(); String getDisplayString(); void drop(String columnName); boolean isOverriden(); static Comparator<Sender> comparatorByColumn(String column); @Override int hashCode(); @Override boolean equals(Object obj); }
Sender { public static Comparator<Sender> comparatorByColumn(String column) { Comparator<String> nullLast = Comparator.nullsLast(String::compareTo); return Comparator.comparing(s -> s.get(column), nullLast); } Sender(Dataset dataset);  Sender(Map<String, String> dsoverride);  Sender(String key, Dataset dataset, Map<String, String> dsoverride);  Sender(Sender copy); String getKey(); Dataset getDataset(); Map<String, String> getOverridenValues(); boolean isSelected(); void setSelected(boolean selected); String get(String columnName); String getFromDatabase(String columnName); void overrideValue(String columnName, String newValue); boolean isFromDatabase(); String getDisplayString(); void drop(String columnName); boolean isOverriden(); static Comparator<Sender> comparatorByColumn(String column); @Override int hashCode(); @Override boolean equals(Object obj); static final String NACHNAME; static final String VORNAME; static final String ROLLE; }