Java Programming Tutorials

Java programming tutorials with many code examples!

Java Util Optional.ofNullable(T)

java.util.Optional.ofNullable(T)

The method Optional.ofNullable(T) returns Optional containing given value if it was not null or an empty Optional in case of null value.

Read More

Share with the World!

Java Util Map replaceAll(BiFunction)

java.util.Map.replaceAll(BiFunction)

The method Map.replaceAll(BiFunction) replaces each value with the result of applying the given function on the corresponding entry. Rethrows exceptions thrown by the replacement function.

Read More

Share with the World!

Java Util Map replace(key, oldValue, newValue)

java.util.Map.replace(key, oldValue, newValue)

The method Map.replace(key, oldValue, newValue) replaces the value associated with the given key only if it is currently mapped to the oldValue.

Read More

Share with the World!

Java Util Map.putIfAbsent(key, value)

java.util.Map.putIfAbsent(key, value)

The method Map.putIfAbsent(key, value) associates the given key with the given value if there is no such association or the current value in map is null. Returns null or the previous value.

Read More

Share with the World!

Java Util Map merge(key, value, BiFunction)

java.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.

Read More

Share with the World!

Java Util Map getOrDefault

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.

Read More

Share with the World!

Java Util Map forEach(BiConsumer)

java.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.

Read More

Share with the World!
Pages:1234