/** make a new iterator which is the elementwise _map1_ of the base iterator. */ @Override public <U> ExtendedIterator<U> mapWith( Function<T, U> map1 ) { return new Map1Iterator<>( map1, this ); }
public void testCloseClosesBaseIterator() { LoggingClosableIterator<String> base = new LoggingClosableIterator<>( null ); Map1Iterator<String, String> mit = new Map1Iterator<>( s -> null, base ); mit.close(); assertTrue( "base must have been closed by closing map", base.isClosed() ); } }
public void testCloseClosesBaseIterator() { LoggingClosableIterator<String> base = new LoggingClosableIterator<>( null ); Map1Iterator<String, String> mit = new Map1Iterator<>( s -> null, base ); mit.close(); assertTrue( "base must have been closed by closing map", base.isClosed() ); } }
/** make a new iterator which is the elementwise _map1_ of the base iterator. */ @Override public <U> ExtendedIterator<U> mapWith( Function<T, U> map1 ) { return new Map1Iterator<>( map1, this ); }
public StmtIterator asStatements( final Iterator<Triple> it ) { return new StmtIteratorImpl( new Map1Iterator<>( t -> asStatement( t ), it ) ); }
public StmtIterator asStatements( final Iterator<Triple> it ) { return new StmtIteratorImpl( new Map1Iterator<>( t -> asStatement( t ), it ) ); }
private static <T> Iterator<PairEntry<T, T>> pairEntry(Map.Entry<T, Set<T>> pair) { final T a = pair.getKey() ; Set<T> bs = pair.getValue() ; return new Map1Iterator<>(b -> new PairEntry<>(a, b), bs.iterator()) ; }
private static <T> Iterator<PairEntry<T, T>> pairEntry(Map.Entry<T, Set<T>> pair) { final T a = pair.getKey() ; Set<T> bs = pair.getValue() ; return new Map1Iterator<>(b -> new PairEntry<>(a, b), bs.iterator()) ; }
/** * An Iterator over the pairs of the Relation. * Each pair is returned as a java.util.Map.Entry. * The first element is accessed through <code>getKey()</code>, * the second through <code>getValue()</code>. *@see java.util.Map.Entry */ public Iterator<PairEntry<T, T>> iterator() { Map1Iterator<Map.Entry<T, Set<T>>,Iterator<PairEntry<T, T>>> iter1 = new Map1Iterator<>( entry -> pairEntry(entry) , rows.entrySet().iterator()) ; // And now flatten it. Iterator<PairEntry<T, T>> iter2 = WrappedIterator.createIteratorIterator(iter1) ; return iter2 ; } }
/** * An Iterator over the pairs of the Relation. * Each pair is returned as a java.util.Map.Entry. * The first element is accessed through <code>getKey()</code>, * the second through <code>getValue()</code>. *@see java.util.Map.Entry */ public Iterator<PairEntry<T, T>> iterator() { Map1Iterator<Map.Entry<T, Set<T>>,Iterator<PairEntry<T, T>>> iter1 = new Map1Iterator<>( entry -> pairEntry(entry) , rows.entrySet().iterator()) ; // And now flatten it. Iterator<PairEntry<T, T>> iter2 = WrappedIterator.createIteratorIterator(iter1) ; return iter2 ; } }
new Map1Iterator<>(bkt -> bkt.iterator(), Arrays.asList(bucketArray).iterator()));
new Map1Iterator<>(bkt -> bkt.iterator(), Arrays.asList(bucketArray).iterator()));