I'm accessing deeply nested json objects in an Android project, and I'd like to not have to do upwards of 4 null checks to reference specific objects.
In JS, Lodash has the .get()
function, which makes accessing those contents much more concise. Is there something similar available for Java?
edit: FWIW, I wrote an implementation of this using Reflection. Because of the inherent performance hit of Reflection, this is probably not a good candidate for hot code paths. Would be interested to see alternatives.
Try this - https://javadev.github.io/underscore-java/ . It's underscore.js in java with find()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.