/** * Finds and returns the key in this Counter with the largest count. * Ties are broken according to the natural ordering of the objects. * This will prefer smaller numeric keys and lexicographically earlier * String keys. To use a different tie-breaking Comparator, use * {@link #argmax(Comparator)}. Returns null if this Counter is empty. */ public E argmax() { return argmax(ErasureUtils.<Comparator<E>>uncheckedCast(naturalComparator)); }
public Object aggregate(Class key, List<? extends CoreMap> in) { if (in == null) return null; IntCounter<Object> counter = new IntCounter<>(); for (CoreMap cm:in) { Object obj = cm.get(key); if (obj != null && (ignoreSet == null || !ignoreSet.contains(obj))) { counter.incrementCount(obj); } } if (counter.size() > 0) { return counter.argmax(); } else { return null; } } }
/** * Finds and returns the key in this Counter with the largest count. * Ties are broken according to the natural ordering of the objects. * This will prefer smaller numeric keys and lexicographically earlier * String keys. To use a different tie-breaking Comparator, use * {@link #argmax(Comparator)}. Returns null if this Counter is empty. */ public E argmax() { return argmax(ErasureUtils.<Comparator<E>>uncheckedCast(naturalComparator)); }
/** * Finds and returns the key in this Counter with the largest count. * Ties are broken according to the natural ordering of the objects. * This will prefer smaller numeric keys and lexicographically earlier * String keys. To use a different tie-breaking Comparator, use * {@link #argmax(Comparator)}. Returns null if this Counter is empty. */ public E argmax() { return argmax(ErasureUtils.<Comparator<E>>uncheckedCast(naturalComparator)); }
/** * Finds and returns the key in this Counter with the largest count. * Ties are broken according to the natural ordering of the objects. * This will prefer smaller numeric keys and lexicographically earlier * String keys. To use a different tie-breaking Comparator, use * {@link #argmax(Comparator)}. Returns null if this Counter is empty. */ public E argmax() { return argmax(ErasureUtils.<Comparator<E>>uncheckedCast(naturalComparator)); }
/** * Finds and returns the key in this Counter with the largest count. * Ties are broken according to the natural ordering of the objects. * This will prefer smaller numeric keys and lexicographically earlier * String keys. To use a different tie-breaking Comparator, use * {@link #argmax(Comparator)}. Returns null if this Counter is empty. */ public E argmax() { return argmax(ErasureUtils.<Comparator<E>>uncheckedCast(naturalComparator)); }
public Object aggregate(Class key, List<? extends CoreMap> in) { if (in == null) return null; IntCounter<Object> counter = new IntCounter<>(); for (CoreMap cm:in) { Object obj = cm.get(key); if (obj != null && (ignoreSet == null || !ignoreSet.contains(obj))) { counter.incrementCount(obj); } } if (counter.size() > 0) { return counter.argmax(); } else { return null; } } }
public Object aggregate(Class key, List<? extends CoreMap> in) { if (in == null) return null; IntCounter<Object> counter = new IntCounter<Object>(); for (CoreMap cm:in) { Object obj = cm.get(key); if (obj != null && (ignoreSet == null || !ignoreSet.contains(obj))) { counter.incrementCount(obj); } } if (counter.size() > 0) { return counter.argmax(); } else { return null; } } }
public Object aggregate(Class key, List<? extends CoreMap> in) { if (in == null) return null; IntCounter<Object> counter = new IntCounter<>(); for (CoreMap cm:in) { Object obj = cm.get(key); if (obj != null && (ignoreSet == null || !ignoreSet.contains(obj))) { counter.incrementCount(obj); } } if (counter.size() > 0) { return counter.argmax(); } else { return null; } } }
public Object aggregate(Class key, List<? extends CoreMap> in) { if (in == null) return null; IntCounter<Object> counter = new IntCounter<Object>(); for (CoreMap cm:in) { Object obj = cm.get(key); if (obj != null && (ignoreSet == null || !ignoreSet.contains(obj))) { counter.incrementCount(obj); } } if (counter.size() > 0) { return counter.argmax(); } else { return null; } } }