Package com.atlassian.jira.util.function
Class Predicates
java.lang.Object
com.atlassian.jira.util.function.Predicates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate<T>
distinctByKey
(Function<? super T, Object> extractor) Returns thread-safe stateful predicate that returns whether it has seen the extracted value.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.distinctByKey
(Function<? super T, Object> extractor, S seenSet) Returns stateful predicate that returns whether it has seen the extracted value.
-
Constructor Details
-
Predicates
public Predicates()
-
-
Method Details
-
distinctByKey
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 valueinitialCapacity
- 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 valueseenSet
- backing collection that will be used to store whether given value was seen
-