I try to commit my code but the code analysis in IntelliJ shows: 'if' statement can be simpolified in this line:
if (legendTitle != null && legendTitle.equals("My house"))
legendTitle is a String, I wrote legendTitle != null because .equals in a null Strings is a NullPointerException
legendTitleis the result of some method call, you could consider changing the return type of that method call toOptional<String>and use the appropriateOptionalmethods, but if it is something local, that would probably be unnecessary overhead. - HulklegendTitleisnull? Because if you consider this a bug in your code you should actually trigger the exception on purpose, fail-fast. Otherwise you wont notice the bug. However, in that case preferObjects.requireNonNull(legendTitle);, more expressive. - Zabuzard