September 2019
Intermediate to advanced
816 pages
18h 47m
English
Let's suppose that we have the following Map:
Map<String, String> map = new HashMap<>();map.put("postgresql", "9.6.1 ");map.put("mysql", "5.1 5.2 5.6 ");
We use this map to store the versions of each database type separated by a space.
Now, let's assume that every time a new version of a database type is released, we want to add it to our map under the corresponding key. If the key (for example, mysql) is present in the map, then we want to simply concatenate the new version to the end of the current value. If the key (for example, derby) is not present in the map, then we just want to add it now.
This is the perfect job for V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction).
If the ...