public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
/** * Removes all entries with keys (first key set) in the given collection * * @param <E> * @param counter * @param removeKeysCollection */ public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
/** * Removes all entries with counts below the given threshold, returning the * set of removed entries. * * @param counter The counter. * @param countThreshold * The minimum count for an entry to be kept. Entries (strictly) less * than this threshold are discarded. * @return The set of discarded entries. */ public static <E1, E2> Set<Pair<E1, E2>> retainAbove( TwoDimensionalCounter<E1, E2> counter, double countThreshold) { Set<Pair<E1, E2>> removed = new HashSet<>(); for (Entry<E1, ClassicCounter<E2>> en : counter.entrySet()) { for (Entry<E2, Double> en2 : en.getValue().entrySet()) { if (counter.getCount(en.getKey(), en2.getKey()) < countThreshold) { removed.add(new Pair<>(en.getKey(), en2.getKey())); } } } for (Pair<E1, E2> key : removed) { counter.remove(key.first(), key.second()); } return removed; }
/** * Removes all entries with keys (first key set) in the given collection * * @param <E> * @param counter * @param removeKeysCollection */ public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
/** * Removes all entries with keys (first key set) in the given collection * * @param <E> * @param counter * @param removeKeysCollection */ public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
/** * Removes all entries with keys (first key set) in the given collection * * @param <E> * @param counter * @param removeKeysCollection */ public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
public static <E, F> void removeKeys(TwoDimensionalCounter<E, F> counter, Collection<E> removeKeysCollection) { for (E key : removeKeysCollection) counter.remove(key); }
/** * Removes all entries with counts below the given threshold, returning the * set of removed entries. * * @param counter The counter. * @param countThreshold * The minimum count for an entry to be kept. Entries (strictly) less * than this threshold are discarded. * @return The set of discarded entries. */ public static <E1, E2> Set<Pair<E1, E2>> retainAbove( TwoDimensionalCounter<E1, E2> counter, double countThreshold) { Set<Pair<E1, E2>> removed = new HashSet<>(); for (Entry<E1, ClassicCounter<E2>> en : counter.entrySet()) { for (Entry<E2, Double> en2 : en.getValue().entrySet()) { if (counter.getCount(en.getKey(), en2.getKey()) < countThreshold) { removed.add(new Pair<>(en.getKey(), en2.getKey())); } } } for (Pair<E1, E2> key : removed) { counter.remove(key.first(), key.second()); } return removed; }
/** * Removes all entries with counts below the given threshold, returning the * set of removed entries. * * @param counter The counter. * @param countThreshold * The minimum count for an entry to be kept. Entries (strictly) less * than this threshold are discarded. * @return The set of discarded entries. */ public static <E1, E2> Set<Pair<E1, E2>> retainAbove( TwoDimensionalCounter<E1, E2> counter, double countThreshold) { Set<Pair<E1, E2>> removed = new HashSet<>(); for (Entry<E1, ClassicCounter<E2>> en : counter.entrySet()) { for (Entry<E2, Double> en2 : en.getValue().entrySet()) { if (counter.getCount(en.getKey(), en2.getKey()) < countThreshold) { removed.add(new Pair<>(en.getKey(), en2.getKey())); } } } for (Pair<E1, E2> key : removed) { counter.remove(key.first(), key.second()); } return removed; }
/** * Removes all entries with counts below the given threshold, returning the * set of removed entries. * * @param counter * The counter. * @param countThreshold * The minimum count for an entry to be kept. Entries (strictly) less * than this threshold are discarded. * @return The set of discarded entries. */ public static <E1, E2> Set<Pair<E1, E2>> retainAbove( TwoDimensionalCounter<E1, E2> counter, double countThreshold) { Set<Pair<E1, E2>> removed = new HashSet<Pair<E1, E2>>(); for (Entry<E1, ClassicCounter<E2>> en : counter.entrySet()) { for (Entry<E2, Double> en2 : en.getValue().entrySet()) { if (counter.getCount(en.getKey(), en2.getKey()) < countThreshold) { removed.add(new Pair<E1, E2>(en.getKey(), en2.getKey())); } } } for (Pair<E1, E2> key : removed) { counter.remove(key.first(), key.second()); } return removed; }