Class NullSafeCopies


  • public class NullSafeCopies
    extends Object
    • Method Detail

      • copyOf

        public static <K,​V> Map<K,​V> copyOf​(@Nullable
                                                        Map<K,​V> map)
      • copyOf

        public static <E> List<E> copyOf​(@Nullable
                                         E[] array)
      • copyWithNullOf

        public static <E> List<E> copyWithNullOf​(@Nullable
                                                 List<E> list)
        Copies given List with keeping null value if provided.
        Parameters:
        list - instance to copy (maybe null)
        Returns:
        if the parameter is not-null then immutable copy; null otherwise
      • copyWithNullOf

        public static <K,​V> Map<K,​V> copyWithNullOf​(@Nullable
                                                                Map<K,​V> map)
        Copies given Map with keeping null value if provided.
        Parameters:
        map - instance to copy (maybe null)
        Returns:
        if the parameter is not-null then immutable copy; null otherwise
      • copyWithNullOf

        public static <E> List<E> copyWithNullOf​(@Nullable
                                                 Iterable<E> iterable)
        Copies given Iterable into immutable List with keeping null value if provided.
        Parameters:
        iterable - instance to copy (maybe null)
        Returns:
        if the parameter is not-null then immutable copy; null otherwise
      • copyWithNullOf

        public static <E> List<E> copyWithNullOf​(@Nullable
                                                 E[] array)
        Copies given array into immutable List with keeping null value if provided.
        Parameters:
        array - instance to copy (maybe null)
        Returns:
        if the parameter is not-null then immutable copy; null otherwise