Package fj.data.hlist

Class HList<A extends HList<A>>

  • Type Parameters:
    A - The specific type of the list, as a subtype of HList
    Direct Known Subclasses:
    HList.HCons, HList.HNil

    public abstract class HList<A extends HList<A>>
    extends java.lang.Object
    Type-safe heterogeneous lists.
    • Constructor Detail

      • HList

        HList()
    • Method Detail

      • extend

        public abstract <E> HList.HCons<E,​A> extend​(E e)
        Extends (cons) this list by prepending the given element, returning a new list.
        Parameters:
        e - an element to prepend to this list.
        Returns:
        a new heterogeneous list, consisting of the given element prepended to this list.
      • nil

        public static HList.HNil nil()
        Returns the empty list.
        Returns:
        the empty list.
      • cons

        public static <E,​L extends HList<L>> HList.HCons<E,​L> cons​(E e,
                                                                               L l)
        Returns a heterogeneous list consisting of an element and another list.
        Parameters:
        e - an element to put in a list.
        l - the rest of the list.
        Returns:
        a heterogeneous list consisting of an element and another list.
      • single

        public static <E> HList.HCons<E,​HList.HNil> single​(E e)
        Returns a heterogeneous list consisting of a single element.
        Parameters:
        e - an element to put in a list
        Returns:
        a heterogeneous list consisting of a single element.