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