Java Code Examples for java.util.stream.Collectors#toConcurrentMap()

The following examples show how to use java.util.stream.Collectors#toConcurrentMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamUtil.java    From BlogManagePlatform with Apache License 2.0 4 votes vote down vote up
/**
 * 返回collector
 * @author Frodez
 * @date 2019-12-09
 */
public Collector<T, ?, ConcurrentHashMap<K, V>> concurrentHashMap() {
	Assert.notNull(keyMapper, "keyMapper must not be null");
	Assert.notNull(valueMapper, "valueMapper must not be null");
	return Collectors.toConcurrentMap(keyMapper, valueMapper, mergeFunction(), ConcurrentHashMap::new);
}
 
Example 2
Source File: Utils.java    From YouTube-In-Background with MIT License 4 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.N)
public static <K, U> Collector<Map.Entry<K, U>, ?, ConcurrentMap<K, U>> entriesToConcurrentMap()
{
    return Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue);
}