Class CollectionUtil


  • public class CollectionUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> immutableList​(java.util.List<T> l)
      Make an unmodifiable shallow copy of the argument.
      static <T> java.util.List<T> immutableListOrEmpty​(java.util.List<T> l)
      Alias of s == null ? Collections.emptyList() : CollectionUtil.immutableList(s).
      static <K,​V>
      java.util.Map<K,​V>
      immutableMap​(java.util.Map<K,​V> m)
      Make an unmodifiable shallow copy of the argument.
      static <T> java.util.Set<T> immutableSet​(java.util.Set<T> s)
      Make an unmodifiable shallow copy of the argument.
      static <T> java.util.Set<T> immutableSetOrEmpty​(java.util.Set<T> s)
      Alias of s == null ? Collections.emptySet() : CollectionUtil.immutableSet(s).
      static <T> java.util.SortedSet<T> immutableSortedSet​(java.util.Set<T> s)
      Make an unmodifiable shallow copy of the argument.
      • Methods inherited from class java.lang.Object

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

      • CollectionUtil

        public CollectionUtil()
    • Method Detail

      • immutableMap

        public static <K,​V> java.util.Map<K,​V> immutableMap​(java.util.Map<K,​V> m)
        Make an unmodifiable shallow copy of the argument.
        Returns:
        A shallow copy of m which cannot be modified
      • immutableList

        public static <T> java.util.List<T> immutableList​(java.util.List<T> l)
        Make an unmodifiable shallow copy of the argument.
        Returns:
        A shallow copy of l which cannot be modified
      • immutableListOrEmpty

        public static <T> java.util.List<T> immutableListOrEmpty​(java.util.List<T> l)
        Alias of s == null ? Collections.emptyList() : CollectionUtil.immutableList(s).
      • immutableSet

        public static <T> java.util.Set<T> immutableSet​(java.util.Set<T> s)
        Make an unmodifiable shallow copy of the argument.
        Returns:
        A shallow copy of s which cannot be modified
      • immutableSetOrEmpty

        public static <T> java.util.Set<T> immutableSetOrEmpty​(java.util.Set<T> s)
        Alias of s == null ? Collections.emptySet() : CollectionUtil.immutableSet(s).
      • immutableSortedSet

        public static <T> java.util.SortedSet<T> immutableSortedSet​(java.util.Set<T> s)
        Make an unmodifiable shallow copy of the argument.
        Returns:
        A shallow copy of s which cannot be modified