com.sportradar.utils.StreamUtils Maven / Gradle / Ivy
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.utils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* Generic stream utility methods
*/
public class StreamUtils {
private StreamUtils() {}
/**
* Utility method used to filter out objects by some parameter
*
* @param keyExtractor the provider of the parameter on which to distinct the objects
* @param the objects type
* @return true
if the object was already filtered, otherwise false
*/
public static Predicate distinctObjects(Function keyExtractor) {
Map