com.ajjpj.abase.collection.immutable.ATraversable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of a-base Show documentation
Show all versions of a-base Show documentation
a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations
package com.ajjpj.abase.collection.immutable;
import com.ajjpj.abase.function.AFunction1;
import com.ajjpj.abase.function.AFunction2;
import com.ajjpj.abase.function.APredicate;
import com.ajjpj.abase.function.AStatement1;
/**
* This interface represents collections that can be traversed "as whole" but not necessarily stepwise. Persistent collections
* are typical examples of this: They require cleanup (resource deallocation) after iterating is through, and exporting a
* java.util.Iterator
can not guarantee that.
*
* @author arno
*/
public interface ATraversable extends AMonadicOps {
void forEach(AStatement1 super T, E> f) throws E;
@Override ATraversable filter(APredicate super T, E> pred) throws E;
@Override ATraversable map(AFunction1 super T, ? extends X, E> f) throws E;
@Override ATraversable flatMap(AFunction1 super T, ? extends Iterable, E> f) throws E;
R foldLeft(R startValue, AFunction2 f) throws E;
@Override AOption find(APredicate super T, E> pred) throws E;
@Override ATraversable flatten();
@Override boolean forAll(APredicate super T, E> pred) throws E;
@Override boolean exists(APredicate super T, E> pred) throws E;
}