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.11.18598.20241113T125352Z-241000
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