Class CollectionUtils

java.lang.Object
io.activej.common.collection.CollectionUtils

public final class CollectionUtils extends Object
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • concat

      public static <D> List<D> concat(List<? extends D> list1, List<? extends D> list2)
      Concatenates two lists into one

      No guarantee on a mutability of a resulting list is made, so list should be considered unmodifiable

      If any of concatenated lists is modified, the behaviour of a concatenated list is undefined

      Throws:
      NullPointerException - may be thrown if any list is null or contains null elements
    • difference

      public static <T> Set<T> difference(Set<? extends T> a, Set<? extends T> b)
      Returns a difference of two sets

      No guarantee on a mutability of a resulting set is made, so set should be considered unmodifiable

      If any of provided sets is modified, the behaviour of a resulting set is undefined

    • intersection

      public static <T> Set<T> intersection(Set<? extends T> a, Set<? extends T> b)
      Returns an intersection of two sets

      No guarantee on a mutability of a resulting set is made, so set should be considered unmodifiable

      If any of provided sets is modified, the behaviour of a resulting set is undefined

    • hasIntersection

      public static <T> boolean hasIntersection(Set<? extends T> a, Set<? extends T> b)
    • union

      public static <T> Set<T> union(Set<? extends T> a, Set<? extends T> b)
      Returns a union of two sets

      No guarantee on a mutability of a resulting set is made, so set should be considered unmodifiable

      If any of provided sets is modified, the behaviour of a resulting set is undefined

    • first

      public static <T> T first(List<? extends T> list)
    • first

      public static <T> T first(Iterable<? extends T> iterable)
    • last

      public static <T> T last(List<? extends T> list)
    • last

      public static <T> T last(Iterable<? extends T> iterable)
    • newHashMap

      public static <K, V> HashMap<K,V> newHashMap(int initialSize)
    • newLinkedHashMap

      public static <K, V> LinkedHashMap<K,V> newLinkedHashMap(int initialSize)
    • newHashSet

      public static <T> HashSet<T> newHashSet(int initialSize)
    • newLinkedHashSet

      public static <T> LinkedHashSet<T> newLinkedHashSet(int initialSize)