-
Notifications
You must be signed in to change notification settings - Fork 2
Introduction to NullableJ
Nawa Manusitthipol edited this page Feb 4, 2018
·
1 revision
Java Uitility used to deal with 'null'. It is designed to used with Lombok @ExtensionMethod (see here and here). This means it will be the most beneficial when used with @ExtensionMethod although you can use the utilities without that. The use of Lomlok's extension methods particularly magnify the value of null-safty done to all the utility methods.
For example, you can write code like this...
// string CAN BE NULL.
return string._whenMatches("^[0-9]+$").map(Integer::parseInt).orElse(-1);
// ^^^^^^^^^^^^The above code parse the string to an int or return -1 if the string is null or does not contains an integer.