Created
August 24, 2018 03:31
-
-
Save herdianf/53c8678c1d14d4f547996602c8661dbd to your computer and use it in GitHub Desktop.
Create a Map with just one line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object data = new Date(); | |
Map<String,Object> map = Arrays.asList(new Object[][] { | |
{ "data", data }, | |
{ "success", true } | |
}).stream().collect(Collectors.toMap(k -> (String)k[0], v -> v[1])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NPE will throw for null