Class CollectionUtil


  • public class CollectionUtil
    extends java.lang.Object
    helper/convenience methods for working with collections.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isEmpty​(java.util.Collection collection)  
      static boolean isNotEmpty​(java.util.Collection collection)  
      static java.util.Map<java.lang.String,​java.lang.Object> map​(java.lang.Object... objects)
      Helper method to easily create a map.
      static java.util.Map<java.lang.String,​java.lang.Object> singletonMap​(java.lang.String key, java.lang.Object value)
      Helper method that creates a singleton map.
      • Methods inherited from class java.lang.Object

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

      • singletonMap

        public static java.util.Map<java.lang.String,​java.lang.Object> singletonMap​(java.lang.String key,
                                                                                          java.lang.Object value)
        Helper method that creates a singleton map. Alternative for Collections.singletonMap(), since that method returns a generic typed map depending on the input type, but we often need a map.
      • map

        public static java.util.Map<java.lang.String,​java.lang.Object> map​(java.lang.Object... objects)
        Helper method to easily create a map. Takes as input a varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally.
      • isEmpty

        public static boolean isEmpty​(java.util.Collection collection)
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.Collection collection)