Skip to content

Cannot invoke "java.util.Map.get(Object)" because "map" is null #123

Answered by bbakerman
ddirkson asked this question in Q&A
Discussion options

You must be logged in to vote

Great - I was just about to reply back that you MUST a non null map

I have this check in the code

        CompletableFuture<Map<K, V>> mapBatchLoad = nonNull(loadResult, () -> "Your batch loader function MUST return a non null CompletionStage").toCompletableFuture();

perhaps we could change the code to either require a non null map OR handle null as if its an empty map. I think reuiring a non null map is better - it would tell you straight away via an assert that your exceptionally -> return null was the problem

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bbakerman
Comment options

Answer selected by bbakerman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants