public static <T> T maxOccurring(@NotNull final Iterable<T> items, final Comparator<? super T> comparator)
{
val lookup = new TreeMap<T, ModuloCounter>(comparator);
for (T item : items)
if (!lookup.containsKey(item))
lookup.put(item, new ModuloCounter(Long.MAX_VALUE - 1));
else
lookup.get(item).next();
if (lookup.size() <= 0)
return null;