Class Sets

org.elasticsearch.common.util.set.Sets

public final class Sets extends
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> <T>
    <T> left, <T> right)
    The relative complement, or difference, of the specified left and right set.
    static <T> boolean
    <T> left, <T> right)
     
    static <T> boolean
    <T> left, <T> right)
     
    static <T> <T>
    <T> set1, <T> set2)
     
    static <T> <T>
     
    static <T> <T>
    <T> iterable)
     
    static <T> <T>
    <T> iterator)
     
    static <T> <T>
    newHashSet​(T... elements)
     
    static <T> <T>
    <T> left, <T> right)
    The relative complement, or difference, of the specified left and right set, returned as a sorted set.
    static <T> <T,​<T>,​<T>>
    Returns a that accumulates the input elements into a sorted set.
    static <T> <T,​<T>,​<T>>
    Returns a that accumulates the input elements into a sorted set and finishes the resulting set into an unmodifiable set.
    static <T> <T>
    <T> left, <T> right)
     

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Method Details

    • newHashSet

      public static <T> <T> newHashSet(<T> iterator)
    • newHashSet

      public static <T> <T> newHashSet(<T> iterable)
    • newHashSet

      public static <T> <T> newHashSet(T... elements)
    • newConcurrentHashSet

      public static <T> <T> newConcurrentHashSet()
    • haveEmptyIntersection

      public static <T> boolean haveEmptyIntersection(<T> left, <T> right)
    • haveNonEmptyIntersection

      public static <T> boolean haveNonEmptyIntersection(<T> left, <T> right)
    • difference

      public static <T> <T> difference(<T> left, <T> right)
      The relative complement, or difference, of the specified left and right set. Namely, the resulting set contains all the elements that are in the left set but not in the right set. Neither input is mutated by this operation, an entirely new set is returned.
      Type Parameters:
      T - the type of the elements of the sets
      Parameters:
      left - the left set
      right - the right set
      Returns:
      the relative complement of the left set with respect to the right set
    • sortedDifference

      public static <T> <T> sortedDifference(<T> left, <T> right)
      The relative complement, or difference, of the specified left and right set, returned as a sorted set. Namely, the resulting set contains all the elements that are in the left set but not in the right set, and the set is sorted using the natural ordering of element type. Neither input is mutated by this operation, an entirely new set is returned.
      Type Parameters:
      T - the type of the elements of the sets
      Parameters:
      left - the left set
      right - the right set
      Returns:
      the sorted relative complement of the left set with respect to the right set
    • toSortedSet

      public static <T> <T,​<T>,​<T>> toSortedSet()
      Returns a that accumulates the input elements into a sorted set.
      Type Parameters:
      T - the type of the input elements
      Returns:
      a sorted set
    • toUnmodifiableSortedSet

      public static <T> <T,​<T>,​<T>> toUnmodifiableSortedSet()
      Returns a that accumulates the input elements into a sorted set and finishes the resulting set into an unmodifiable set. The resulting read-only view through the unmodifiable set is a sorted set.
      Type Parameters:
      T - the type of the input elements
      Returns:
      an unmodifiable set where the underlying set is sorted
    • union

      public static <T> <T> union(<T> left, <T> right)
    • intersection

      public static <T> <T> intersection(<T> set1, <T> set2)