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

devutility.internal.util.function.PredicateUtils Maven / Gradle / Ivy

There is a newer version: 1.3.8.1
Show newest version
package devutility.internal.util.function;

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy