Class ConverterUtils


  • public class ConverterUtils
    extends java.lang.Object
    Converter utilities.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <C,​S,​T>
      T
      convert​(C context, S source, java.util.function.BiFunction<C,​S,​T> converter)
      Convert a single source value using the converter function and an additional context.
      static <S,​T>
      T
      convert​(S source, java.util.function.Function<S,​T> converter)
      Convert a single source value using the converter function.
      static <S,​T>
      java.util.List<T>
      convertAll​(java.util.Collection<? extends S> source, java.util.function.Function<S,​T> converter)
      Convert a collection of source values using the converter function.
      static <S,​T>
      java.util.List<T>
      convertAll​(java.util.Collection<? extends S> source, java.util.function.Function<S,​T> converter, java.util.function.Predicate<? super S> filter)
      Convert a collection of source values using the converter function.
      static <P,​S,​T>
      java.util.List<T>
      convertAll​(P first, java.util.Collection<S> source, java.util.function.BiFunction<P,​S,​T> converter)
      Convert a collection of source value using the converter function and an additional context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • convert

        public static final <S,​T> T convert​(S source,
                                                  java.util.function.Function<S,​T> converter)
        Convert a single source value using the converter function.
        Type Parameters:
        S - - source type
        T - - target type
        Parameters:
        source - - source value
        converter - - converter function
        Returns:
        converted value
      • convert

        public static final <C,​S,​T> T convert​(C context,
                                                          S source,
                                                          java.util.function.BiFunction<C,​S,​T> converter)
        Convert a single source value using the converter function and an additional context.
        Type Parameters:
        C - - context type
        S - - source type
        T - - target type
        Parameters:
        context - - context
        source - - source value
        converter - - converter function
        Returns:
        converted value
      • convertAll

        public static final <S,​T> java.util.List<T> convertAll​(java.util.Collection<? extends S> source,
                                                                     java.util.function.Function<S,​T> converter)
        Convert a collection of source values using the converter function.
        Type Parameters:
        S - - source type
        T - - target type
        Parameters:
        source - - source value
        converter - - converter function
        Returns:
        list of converted values
      • convertAll

        public static final <P,​S,​T> java.util.List<T> convertAll​(P first,
                                                                             java.util.Collection<S> source,
                                                                             java.util.function.BiFunction<P,​S,​T> converter)
        Convert a collection of source value using the converter function and an additional context.
        Type Parameters:
        C - - context type
        S - - source type
        T - - target type
        Parameters:
        context - - context
        source - - source value
        converter - - converter function
        Returns:
        list of converted values
      • convertAll

        public static final <S,​T> java.util.List<T> convertAll​(java.util.Collection<? extends S> source,
                                                                     java.util.function.Function<S,​T> converter,
                                                                     java.util.function.Predicate<? super S> filter)
        Convert a collection of source values using the converter function.
        Type Parameters:
        S - - source type
        T - - target type
        Parameters:
        source - - source value
        converter - - converter function
        filter - - filter
        Returns:
        list of converted values