Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returning empty values

See original GitHub issue

From and

What technique should we use, around the sdk, to notify the user of an eventual empty return value?

  1. Optional getters
  2. Have an annotation called @Nullable which notifies the user of an eventual null return value
  3. Just explicit in the Javadoc that a method can return null

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

slinkydevelopercommented, Apr 28, 2020

That said, the same annotation can definitely be used in other modules +1

I would love to, to keep consistency across our modules

bsideupcommented, Apr 23, 2020

@slinkydeveloper I would agree with you if not the usages tab of that dependency where you will find a ton of major Java projects 😉

Anyway, are you willing to provide a PR to add them to api package?

Sure! Expect a PR soon

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found