Class CollectionUtilities

java.lang.Object
com.cedarsoftware.util.CollectionUtilities

public class CollectionUtilities extends Object
Author:
John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Constructor Details

    • CollectionUtilities

      public CollectionUtilities()
  • Method Details

    • isEmpty

      public static boolean isEmpty(Collection col)
      This is a null-safe isEmpty check.
      Parameters:
      col - Collection to check
      Returns:
      true if empty or null
    • hasContent

      public static boolean hasContent(Collection col)
      This is a null-safe isEmpty check.
      Parameters:
      col - Collection to check
      Returns:
      true if empty or null
    • size

      public static int size(Collection col)
      This is a null-safe size check.
      Parameters:
      col - Collection to check
      Returns:
      true if empty or null
    • listOf

      @SafeVarargs public static <T> List<T> listOf(T... items)
      For JDK1.8 support. Remove this and change to List.of() for JDK11+
    • setOf

      @SafeVarargs public static <T> Set<T> setOf(T... items)
      For JDK1.8 support. Remove this and change to Set.of() for JDK11+