Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
5.8.1
-
None
Description
The EventContext is an essential tool for accessing event related data, but its functionality is quite limited.
The most common use case – accessing its data – must be done in a try-catch-block.
If multiple values are involved, the resulting code isn't that pretty.
Adding Optional<T> tryGet(Class<T> desiredType, int index) would allow to access the values in a more lenient way and provide a bridge between a possible null value and the fluent/functional Optional API.
Also, a boolean isEmpty() would cover another common use case with less and more speaking code.