com.unit16.z.indexed.OnResultOf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unit16-z Show documentation
Show all versions of unit16-z Show documentation
A collection of utilities for representing and manipulating time series and such.
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)); }
}