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

com.github.rkmk.container.FoldingListContainerBuilder Maven / Gradle / Ivy

package com.github.rkmk.container;

import com.github.rkmk.Folder;
import org.skife.jdbi.v2.ContainerBuilder;

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

public class FoldingListContainerBuilder implements ContainerBuilder>{

    private final List list;
    private final Folder folder;

    public FoldingListContainerBuilder() {
        this.list = new ArrayList<>();
        this.folder = new Folder();
    }

    @Override
    public ContainerBuilder> add(Object currentObject) {
        folder.fold(list, currentObject);
        return this;
    }

    @Override
    public FoldingList build() {
        return new FoldingList<>(list);
    }

}