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

functionalj.list.FuncListBuilder Maven / Gradle / Ivy

package functionalj.list;

import java.util.ArrayList;
import java.util.List;

public class FuncListBuilder {
    private final List entries;
    private final int count;
    
    public FuncListBuilder() {
        this.entries = new ArrayList();
        this.count = 0;
    }
    private FuncListBuilder(List entries) {
        this.entries = entries;
        this.count = this.entries.size();
    }
    
    public FuncListBuilder with(DATA value) {
        this.entries.add(value);
        return new FuncListBuilder<>(this.entries);
    }
    
    public ImmutableList build() {
        return ImmutableList.from(this.entries.stream().limit(count));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy