@Override public boolean add(T item) { Counter counter = this.items.getIfAbsentPut(item, NEW_COUNTER_BLOCK); counter.increment(); this.size++; return true; }
@Test public void iterator() { Counter counter = new Counter(); for (Object each : this.unmodifiableCollection) { counter.increment(); } Assert.assertEquals(4, counter.getCount()); }