fj.data.Seq Maven / Gradle / Ivy
package fj.data;
import fj.*;
import static fj.Bottom.error;
import static fj.Monoid.intAdditionMonoid;
import static fj.data.fingertrees.FingerTree.measured;
import fj.data.List.Buffer;
import fj.data.fingertrees.FingerTree;
import fj.data.fingertrees.MakeTree;
import fj.data.fingertrees.Measured;
import java.util.AbstractList;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Provides an immutable finite sequence, implemented as a finger tree. This structure gives O(1) access to
* the head and tail, as well as O(log n) random access and concatenation of sequences.
*/
public final class Seq implements Iterable {
private static final Measured ELEM_MEASURED = measured(intAdditionMonoid, Function.constant(1));
private static final MakeTree MK_TREE = FingerTree.mkTree(ELEM_MEASURED);
private static final Seq
© 2015 - 2025 Weber Informatics LLC | Privacy Policy