All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fun.bigtable.kraken.util.StreamUtils Maven / Gradle / Ivy

There is a newer version: 2.0.9.1
Show newest version
package fun.bigtable.kraken.util;

import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;

public class StreamUtils {

    public static  Predicate distinctByKey(Function keyExtractor) {
        ConcurrentHashMap map = new ConcurrentHashMap<>(16);
        return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy