Class Id<T>

  • Type Parameters:
    T - the type of values

    public class Id<T>
    extends Object
    Class representing the identity monad.
    Author:
    Herbert Praehofer
    • Field Detail

      • elem

        public final T elem
        The wrapped value.
    • Constructor Detail

      • Id

        private Id​(T elem)
        Constructor wrapping a value.
        Parameters:
        elem - the wrapped value
    • Method Detail

      • of

        public static <T> Id<T> of​(T elem)
        Creates an Id monad with a wrapped value.
        Type Parameters:
        T - the type of the value
        Parameters:
        elem - the wrapped value
        Returns:
        the monad value with the wrapped value
      • flatMap

        public <R> Id<R> flatMap​(Function<? super T,​? extends Id<? extends R>> mapper)
        Monad operator.
        Type Parameters:
        R - the type of the wrapped result object.
        Parameters:
        mapper - the mapping function
        Returns:
        the wrapped result value