List of usage examples for org.apache.commons.collections15.bag TreeBag TreeBag
public TreeBag(Collection<? extends E> coll)
TreeBag
containing all the members of the specified collection. From source file:de.dhke.projects.cutil.collections.BagUtilTest.java
/** * Test of unionBags method, of class BagUtil. */// w w w. ja v a2 s.c o m @Test public void testUnionBags() { System.out.println("unionBags"); final Bag<String> b0 = new TreeBag<>(Arrays.asList("A", "B", "C")); final Bag<String> b1 = new TreeBag<>(Arrays.asList("A", "C")); final Bag<String> union = new TreeBag<>(); BagUtil.unionBags(b0, b1, union); assertTrue(union.contains("A")); assertTrue(union.contains("B")); assertTrue(union.contains("C")); assertEquals(1, union.getCount("A")); assertEquals(1, union.getCount("B")); assertEquals(1, union.getCount("C")); }
From source file:de.dhke.projects.cutil.collections.BagUtilTest.java
/** * Test of intersectBags method, of class BagUtil. *///from w ww . ja v a 2s. c o m @Test public void testIntersectBags() { System.out.println("intersectBags"); final Bag<String> b0 = new TreeBag<>(Arrays.asList("A", "B", "C")); final Bag<String> b1 = new TreeBag<>(Arrays.asList("A", "C")); final Bag<String> intersection = new TreeBag<>(); BagUtil.intersectBags(b0, b1, intersection); assertTrue(intersection.contains("A")); assertFalse(intersection.contains("B")); assertTrue(intersection.contains("C")); assertEquals(1, intersection.getCount("A")); assertEquals(0, intersection.getCount("B")); assertEquals(1, intersection.getCount("C")); }
From source file:edu.cuny.ai.learning.SortedSlidingWindowLearner.java
public SortedSlidingWindowLearner() { memory = new TreeBag<DataItem>(new DataItemComparator()); }
From source file:edu.cuny.cat.stat.HistoricalReport.java
public HistoricalReport() { asks = new LinkedList<Shout>(); bids = new LinkedList<Shout>(); sortedShouts = new TreeBag<Shout>(new ShoutComparator()); matchedShouts = Collections.synchronizedSet(new HashSet<Shout>()); shoutMap = Collections.synchronizedMap(new HashMap<String, Shout>()); observableProxy = new Observable() { @Override//from w w w .j a v a2 s . co m public void notifyObservers() { setChanged(); super.notifyObservers(); } }; }