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

cz.mmsparams.api.utils.ListUtils Maven / Gradle / Ivy

package cz.mmsparams.api.utils;

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

public class ListUtils
{
    private ListUtils()
    {
    }

    public static List getString(List objList)
    {
        if (objList == null)
            return null;

        final List list = new ArrayList<>();
        for (Object o : objList)
        {
            list.add(o.toString());
        }
        return list;
    }

    public static  List toList2(final Collection> values)
    {
        final List list = new ArrayList<>();
        for (List v : values)
        {
            list.addAll(v);
        }
        return list;
    }

    public static  List toList(final Collection values)
    {
        return new ArrayList<>(values);
    }

    public static  ArrayList toArrayList(List values)
    {
        return new ArrayList<>(values);
    }

    public static  List toList(T[] array)
    {
        return array == null ? new ArrayList<>() : new ArrayList<>(Arrays.asList(array));
    }

    public static  List toListNull(T[] array)
    {
        return array == null ? null : new ArrayList<>(Arrays.asList(array));
    }

    public static  List newList()
    {
        return new ArrayList<>();
    }

    public static  List newList(List items)
    {
        return new ArrayList<>(items);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy