Class CollectionUtils

java.lang.Object
com.querydsl.core.util.CollectionUtils

public final class CollectionUtils extends Object
CollectionUtils provides addition operations for Collection types that provide an immutable type for single item collections and after that mutable instances
Author:
tiwe
  • Method Details

    • isUnmodifiableType

      public static boolean isUnmodifiableType(Class<?> clazz)
      Returns true if the type is a known unmodifiable type.
      Parameters:
      clazz - the type
      Returns:
      true if the type is a known unmodifiable type
    • unmodifiableList

      public static <T> List<T> unmodifiableList(List<T> list)
      Return an unmodifiable copy of a list, or the same list if its already an unmodifiable type.
      Type Parameters:
      T - element type
      Parameters:
      list - the list
      Returns:
      unmodifiable copy of a list, or the same list if its already an unmodifiable type
    • unmodifiableSet

      public static <T> Set<T> unmodifiableSet(Set<T> set)
      Return an unmodifiable copy of a set, or the same set if its already an unmodifiable type.
      Type Parameters:
      T - element type
      Parameters:
      set - the set
      Returns:
      unmodifiable copy of a set, or the same set if its already an unmodifiable type
    • partition

      public static <T> List<List<T>> partition(List<T> list, int batchSize)
    • add

      public static <T> List<T> add(List<T> list, T element)
    • copyOf

      public static <T> List<T> copyOf(List<T> list)
    • add

      public static <T> Set<T> add(Set<T> set, T element)
    • copyOf

      public static <T> Set<T> copyOf(Set<T> set)
    • addSorted

      public static <T> Set<T> addSorted(Set<T> set, T element)
    • removeSorted

      public static <T> Set<T> removeSorted(Set<T> set, T element)
    • copyOfSorted

      public static <T> Set<T> copyOfSorted(Set<T> set)
    • put

      public static <K, V> Map<K,V> put(Map<K,V> map, K key, V value)
    • copyOf

      public static <K, V> Map<K,V> copyOf(Map<K,V> map)