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

com.drew.lang.Iterables Maven / Gradle / Ivy

There is a newer version: 2024.9.17689.20240905T073330Z-240800
Show newest version
package com.drew.lang;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Drew Noakes https://drewnoakes.com
 */
public class Iterables
{
    public static  List toList(Iterable iterable)
    {
        ArrayList list = new ArrayList();
        for (E item : iterable) {
            list.add(item);
        }
        return list;
    }

    public static  Set toSet(Iterable iterable)
    {
        HashSet set = new HashSet();
        for (E item : iterable) {
            set.add(item);
        }
        return set;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy