Class MutableCollections


  • public class MutableCollections
    extends java.lang.Object
    Convenience Methods for handling mutable Collections.
    Author:
    mbrooks
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> copyListFromNullable​(java.util.Collection<T> toCopy)  
      static <T> java.util.List<T> copyListFromNullable​(java.util.Collection<T> toCopy, java.util.function.Supplier<java.util.List<T>> listSupplier)
      Copy a Collection to a List.
      static <T,​S>
      java.util.Map<T,​S>
      copyMapFromNullable​(java.util.Map<T,​S> toCopy)  
      static <T,​S>
      java.util.Map<T,​S>
      copyMapFromNullable​(java.util.Map<T,​S> toCopy, java.util.function.Supplier<java.util.Map<T,​S>> mapSupplier)
      Copy a Map.
      • Methods inherited from class java.lang.Object

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

      • MutableCollections

        public MutableCollections()
    • Method Detail

      • copyListFromNullable

        public static <T> java.util.List<T> copyListFromNullable​(java.util.Collection<T> toCopy,
                                                                 java.util.function.Supplier<java.util.List<T>> listSupplier)
        Copy a Collection to a List.
        Parameters:
        toCopy - the Collection to copy
        listSupplier - the supplier for the desired List type
        Returns:
        a new List containing the same elements as the given Collection
      • copyListFromNullable

        public static <T> java.util.List<T> copyListFromNullable​(java.util.Collection<T> toCopy)
      • copyMapFromNullable

        public static <T,​S> java.util.Map<T,​S> copyMapFromNullable​(java.util.Map<T,​S> toCopy,
                                                                               java.util.function.Supplier<java.util.Map<T,​S>> mapSupplier)
        Copy a Map.
        Parameters:
        toCopy - the Map to copy
        mapSupplier - the supplier for the desired Map type
        Returns:
        a new Map containing the same elements as the given Map
      • copyMapFromNullable

        public static <T,​S> java.util.Map<T,​S> copyMapFromNullable​(java.util.Map<T,​S> toCopy)