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

ch.lambdaj.collection.LambdaCollections Maven / Gradle / Ivy

The newest version!
// Modified or written by Lambdascale SRL for inclusion with lambdaj.
// Copyright (c) 2009-2010 Mario Fusco.
// Licensed under the Apache License, Version 2.0 (the "License")

package ch.lambdaj.collection;

import java.util.*;
import static java.util.Arrays.asList;

/**
 * This class consists exclusively of static methods that allow to create LambdaCollections.
 * @author Gianfranco Tognana
 * @author Mario Fusco
 */
public final class LambdaCollections {
    
    private LambdaCollections() { }

    /**
     * Creates a LambdaIterator that wraps the given Iterator
     * @param iterator The Iterator to be wrapped
     * @return The LambdaIterator that wraps the given Iterator
     */
    public static  LambdaIterator with(Iterator iterator) {
        return new LambdaIterator(iterator);
    }

    /**
     * Creates a LambdaList that wraps the given List
     * @param list The List to be wrapped
     * @return The LambdaList that wraps the given List
     */
    public static  LambdaList with(List list) {
        return new LambdaList(list);
    }

    /**
     * Creates a LambdaList that wraps the given array
     * @param array The array to be wrapped
     * @return The LambdaList that wraps the given array
     */
	public static  LambdaList with(T... array) {
		return new LambdaList(new ArrayList(asList(array)));
	}

    /**
     * Creates a LambdaCollection that wraps the given Collection
     * @param collection The collection to be wrapped
     * @return The LambdaCollection that wraps the given Collection
     */
	public static  LambdaCollection with(Collection collection) {
		return new LambdaCollection(collection);
	}

    /**
     * Creates a LambdaIterable that wraps the given Iterable
     * @param iterable The Iterable to be wrapped
     * @return The LambdaIterable that wraps the given Iterable
     */
	public static  LambdaIterable with(Iterable iterable) {
		return new LambdaIterable(iterable);
	}

    /**
     * Creates a LambdaMap that wraps the given Map
     * @param map The Map to be wrapped
     * @return The LambdaMap that wraps the given Map
     */
	public static  LambdaMap with(Map map) {
		return new LambdaMap(map);
	}

    /**
     * Creates a LambdaSet that wraps the given Set
     * @param set The Set to be wrapped
     * @return The LambdaSet that wraps the given Set
     */
	public static  LambdaSet with(Set set) {
		return new LambdaSet(set);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy