Example usage for com.google.common.collect TransformedIterator TransformedIterator

List of usage examples for com.google.common.collect TransformedIterator TransformedIterator

Introduction

In this page you can find the example usage for com.google.common.collect TransformedIterator TransformedIterator.

Prototype

TransformedIterator(Iterator<? extends F> backingIterator) 

Source Link

Usage

From source file:net.hydromatic.optiq.util.CompatibleGuava11.java

static <K, V> Iterator<K> keyIterator(Iterator<Map.Entry<K, V>> entryIterator) {
    return new TransformedIterator<Map.Entry<K, V>, K>(entryIterator) {
        @Override// ww w. ja  v a 2 s.c  om
        K transform(Map.Entry<K, V> entry) {
            return entry.getKey();
        }
    };
}

From source file:net.hydromatic.optiq.util.CompatibleGuava11.java

private static <K, V> Iterator<Map.Entry<K, V>> asSetEntryIterator(Set<K> set,
        final Function<? super K, V> function) {
    return new TransformedIterator<K, Map.Entry<K, V>>(set.iterator()) {
        @Override/*from w  ww .  j  av a 2  s  .com*/
        Map.Entry<K, V> transform(K key) {
            return Maps.immutableEntry(key, function.apply(key));
        }
    };
}

From source file:net.hydromatic.optiq.util.CompatibleGuava11.java

static <K, V> Iterator<V> valueIterator(Iterator<Map.Entry<K, V>> entryIterator) {
    return new TransformedIterator<Map.Entry<K, V>, V>(entryIterator) {
        @Override//from  w  ww  . j a  v  a2  s  .c  o m
        V transform(Map.Entry<K, V> entry) {
            return entry.getValue();
        }
    };
}