### Question:
FixedOrderComparator implements Comparator<T>, Serializable { public boolean add(final T obj) { checkLocked(); final Integer position = map.put(obj, Integer.valueOf(counter++)); return position == null; } FixedOrderComparator();  FixedOrderComparator(final T... items);  FixedOrderComparator(final List<T> items); boolean isLocked(); UnknownObjectBehavior getUnknownObjectBehavior(); void setUnknownObjectBehavior(final UnknownObjectBehavior unknownObjectBehavior); boolean add(final T obj); boolean addAsEqual(final T existingObj, final T newObj); @Override int compare(final T obj1, final T obj2); @Override int hashCode(); @Override boolean equals(final Object object);  }### Answer:
@Test public void testConstructorPlusAdd() { final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(); for (final String topCitie : topCities) { comparator.add(topCitie); } final String[] keys = topCities.clone(); assertComparatorYieldsOrder(keys, comparator); }