@Test public void nonStrictCacheValuesIteratorRemoveTest() throws Exception { assertNotNull( cache.put( "a", 1L ) ); assertNotNull( cache.put( "b", 2L ) ); assertNotNull( cache.put( "c", 3L ) ); Iterator<Long> iterator = new CacheValuesIterable<String, Long>( cache, false ).iterator(); while ( iterator.hasNext() ) { long longVal = iterator.next(); if (longVal == 2) { iterator.remove(); } } int count = 0; iterator = new CacheValuesIterable<String, Long>( cache, false ).iterator(); while (iterator.hasNext()) { iterator.next(); count++; } assertEquals( 2, count); }
@Override public Iterator<V> iterator() { return strict ? new StrictCacheValuesIterator<K, V>( keysIterator, cacheService ) : new NonStrictCacheValuesIterator<K, V>( keysIterator, cacheService ); }
CacheValuesIterable implements Iterable<V> { @Override public Iterator<V> iterator() { return strict ? new StrictCacheValuesIterator<K, V>( keysIterator, cacheService ) : new NonStrictCacheValuesIterator<K, V>( keysIterator, cacheService ); } }
CacheValuesIterable implements Iterable<V> { @Override public Iterator<V> iterator() { return strict ? new StrictCacheValuesIterator<K, V>( keysIterator, cacheService ) : new NonStrictCacheValuesIterator<K, V>( keysIterator, cacheService ); } CacheValuesIterable( CacheService<K, V> cacheService );  CacheValuesIterable( CacheService<K, V> cacheService, boolean strict ); }
CacheValuesIterable implements Iterable<V> { @Override public Iterator<V> iterator() { return strict ? new StrictCacheValuesIterator<K, V>( keysIterator, cacheService ) : new NonStrictCacheValuesIterator<K, V>( keysIterator, cacheService ); } CacheValuesIterable( CacheService<K, V> cacheService );  CacheValuesIterable( CacheService<K, V> cacheService, boolean strict ); @Override Iterator<V> iterator(); }
CacheValuesIterable implements Iterable<V> { @Override public Iterator<V> iterator() { return strict ? new StrictCacheValuesIterator<K, V>( keysIterator, cacheService ) : new NonStrictCacheValuesIterator<K, V>( keysIterator, cacheService ); } CacheValuesIterable( CacheService<K, V> cacheService );  CacheValuesIterable( CacheService<K, V> cacheService, boolean strict ); @Override Iterator<V> iterator();  }