001    package fp;
002    
003    import listFW.*;
004    import listFW.factory.*;
005    
006    /**
007     * Makes new NEList given a first and rest. Use binary lambda.
008     * @author DXN
009     * @author Mathias Ricken - Copyright 2008 - All rights reserved.
010     */
011    public class Cons2<T> implements ILambda2<IList<T>,T,IList<T>> {
012        IListFactory<T> _fac;
013        public Cons2(IListFactory<T> fac) {
014            _fac = fac;
015        }
016        /**
017         * Creates an NEList with a given first and rest.
018         * @param first the first element of the IList to be created.
019         * @param rest an IList, the rest of the IList to be created.
020         * @return IList
021         */
022        public IList<T> apply(T first, IList<T> rest) {
023            return _fac.makeNEList(first, rest);
024        }
025    }