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

com.ajjpj.abase.collection.immutable.ATraversable Maven / Gradle / Ivy

Go to download

a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations

The newest version!
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 f) throws E;

    @Override  ATraversable filter(APredicate pred) throws E;
    @Override  ATraversable map(AFunction1 f) throws E;
    @Override  ATraversable flatMap(AFunction1, E> f) throws E;
     R foldLeft(R startValue, AFunction2 f) throws E;

    @Override  AOption find(APredicate pred) throws E;

    @Override  ATraversable flatten();

    @Override  boolean forAll(APredicate pred) throws E;
    @Override  boolean exists(APredicate pred) throws E;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy