All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 _f;
	
	OnResultOf(DSL a, Function 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)); }
}