Class Predicates

java.lang.Object
com.atlassian.jira.util.function.Predicates

public class Predicates extends Object
  • Constructor Details

    • Predicates

      public Predicates()
  • Method Details

    • distinctByKey

      public static <T> Predicate<T> distinctByKey(Function<? super T,Object> extractor)
      Returns thread-safe stateful predicate that returns whether it has seen the extracted value.
      Type Parameters:
      T - output type
      Parameters:
      extractor - function that should be used to extract the value
    • distinctByKey

      public static <T> Predicate<T> distinctByKey(Function<? super T,Object> extractor, int initialCapacity)
      Returns thread-safe stateful predicate that returns whether it has seen the extracted value.
      Type Parameters:
      T - output type
      Parameters:
      extractor - function that should be used to extract the value
      initialCapacity - initial capacity of internal state (a.k.a. how many unique elements you expect it to see)
    • distinctByKey

      public static <T, S extends Set<Object>> Predicate<T> distinctByKey(Function<? super T,Object> extractor, S seenSet)
      Returns stateful predicate that returns whether it has seen the extracted value.
      Type Parameters:
      T - output type
      Parameters:
      extractor - function that should be used to extract the value
      seenSet - backing collection that will be used to store whether given value was seen