In Java 8 remove selected item from Collection? It can be done in at least two ways both of which we are going to implement here. Let’s code!
Continue reading Java 8 remove selected item from Collectionjava-collections
Very common task is creation of Map from a List of objects. In this post we show how to use Java 8 to convert List to Map using Collectors.
Continue reading Java 8 List to MapIn this article we present Java 8 forEach on examples. These are very convenient methods for use with Lambda Expressions and method references.
Continue reading Java 8 forEach examplesjava.util.Map.merge(key, value, BiFunction) The method Map.merge(key, value, BiFunction) associates given value with the given key or calculates the new value from the old value and the given one using provided remapping function.
Continue reading Java Util Map merge(key, value, BiFunction)java.util.Map.getOrDefault(key, defaultValue) The method Map.getOrDefault(key, defaultValue) returns mapped value for the given key or defaultValue if there is no such mapping.
Continue reading Java Util Map getOrDefaultjava.util.Map.forEach(BiConsumer) The method Map.forEach(BiConsumer) performs the given action for each entry of the map until all are processed or exception is thrown.
Continue reading Java Util Map forEach(BiConsumer)java.util.Map.computeIfPresent(Key, BiFunction) The method Map.computeIfPresent(Key, BiFunction) computes a new mapping for the given key and its current mapping value if the value exists and is not null.
Continue reading Java Util Map computeIfPresent(Key,BiFunction)java.util.Map.computeIfAbsent(key, Function) The method Map.computeIfAbsent(key, Function) computes the new value and associates it with the key if there is no mapping for the given key or the mapping is null. Returns the new value associated with the key.
Continue reading Java Util Map computeIfAbsent(key,Function)Java PriorityQueue by example In this tutorial we’re going to show how to use PriorityQueue to process queue elements in order of importance, not insertion.
Continue reading Java PriorityQueue by exampleProblem: How to create an immutable List in Java? There are couple of ways to do that, one of them is to use Java Collections Framework as can be seen in the following example.
Continue reading Java immutable List