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

org.hisp.dhis.util.ListBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package org.hisp.dhis.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ListBuilder
{
    private final List list;

    public ListBuilder()
    {
        list = new ArrayList<>();
    }

    public final ListBuilder addAll( List items )
    {
        this.list.addAll( items );
        return this;
    }

    @SafeVarargs
    public final ListBuilder add( T... items )
    {
        this.list.addAll( Arrays.asList( items ) );
        return this;
    }

    public final ListBuilder add( T item )
    {
        this.list.add( item );
        return this;
    }

    public List build()
    {
        return Collections.unmodifiableList( list );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy