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

devutility.internal.util.StreamHelper Maven / Gradle / Ivy

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

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

public class StreamHelper {
	// region distinct by key

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

	// endregion
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy