jSparrow v3.5.0/v2.2.0

Adds new Map::getOrDefault rule to make code more readable, by using Java 8 extensions of Map interface.
May 17, 2019 - 12:40
New Version

Features

  • New Rule - Replace Map::get with Map::getOrDefault
    • Automatically replaces invocations of Map::get with the alternative Map::getOrDefault , thus eliminating the succeeding null checks.
    • Makes the code more readable, by using Java 8 extensions of Map interface.

Java 8 introduced Map::getOrDefault which offers the possibility to return a default value if the map does not contain a mapping for the given key. This rule replaces the invocations of Map::get followed by a null-check with Map::getOrDefault.

jSparrow - Replace Map::get by Map::getOrDefault

jSparrow

Automatic Java Refactoring

Got a Question?

Live Chat with our jSparrow licensing specialists now.