List of usage examples for org.apache.commons.collections15 Bag remove
boolean remove(E object, int nCopies);
nCopies
copies of the specified object from the Bag. From source file:mulavito.utils.BagUtil.java
/** * Set the counter of the given entry in the given set. * // w ww . j a va 2 s .c o m * @param bag * The bag to modify * @param entry * The entry whose counter is set * @param count * The new non-negative counter value */ public static <T> void setCount(Bag<T> bag, T entry, int count) { if (bag == null) throw new IllegalArgumentException(); else if (count < 0) throw new IllegalArgumentException(); int oldCount = bag.getCount(entry); if (count > oldCount) bag.add(entry, count - oldCount); else if (count < oldCount) bag.remove(entry, oldCount - count); }