Class MapTransformer<I,​O>

    • Method Detail

      • mapTransformer

        public static <I,​O> Transformer<I,​O> mapTransformer​(Map<? super I,​? extends O> map)
        Factory to create the transformer.

        If the map is null, a transformer that always returns null is returned.

        Type Parameters:
        I - the input type
        O - the output type
        Parameters:
        map - the map, not cloned
        Returns:
        the transformer
      • transform

        public O transform​(I input)
        Transforms the input to result by looking it up in a Map.
        Specified by:
        transform in interface Transformer<I,​O>
        Parameters:
        input - the input object to transform
        Returns:
        the transformed result
      • getMap

        public Map<? super I,​? extends O> getMap()
        Gets the map to lookup in.
        Returns:
        the map
        Since:
        3.1