com.unit16.z.indexed.OnResultOf Maven / Gradle / Ivy
package com.unit16.z.indexed;
import java.util.Iterator;
import java.util.function.Function;
import com.google.common.collect.Iterators;
final class OnResultOf
extends DSL
{
private final DSL _a;
private final Function super A, ? extends B> _f;
OnResultOf(DSL a, Function super A, ? extends B> f)
{
_a = a;
_f = f;
}
@Override
public B get(int i) {
return _f.apply(_a.get(i));
}
@Override
public int size() { return _a.size(); }
@Override
public Iterator iterator() { return Iterators.transform(_a.iterator(), x -> _f.apply(x)); }
}