Returning empty values
See original GitHub issueFrom https://github.com/cloudevents/sdk-java/issues/119 and https://github.com/cloudevents/sdk-java/pull/108#discussion_r411193730:
What technique should we use, around the sdk, to notify the user of an eventual empty return value?
Optional
getters- Have an annotation called
@Nullable
which notifies the user of an eventual null return value - Just explicit in the Javadoc that a method can return null
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
3 Clever Ways to Return Empty Value Instead of Null From a ...
It is best practice to return empty values rather than null ones. Especially when you return a collection, enumerable, or an object, you...
Read more >Is it better to return NULL or empty values from functions ...
An empty object implies data has been returned, whereas returning null clearly indicates that nothing has been returned. Additionally, returning a null will ......
Read more >Should functions return null or an empty object? - Stack Overflow
Returning null is usually the best idea if you intend to indicate that no data is available. An empty object implies data has...
Read more >data weave returns empty values - MuleSoft Help Center
When i iterate using dataweave it is giving empty and returns only last column value could anyone help here. below is the data...
Read more >MET55-J. Return an empty array or collection instead of a null ...
In this code example, the client lacks any null value check, causing a NullPointerException at runtime.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would love to, to keep consistency across our modules
@slinkydeveloper I would agree with you if not the usages tab of that dependency where you will find a ton of major Java projects 😉
Sure! Expect a PR soon