JavaWebStack / abstract-data

A library to abstractly represent structured data and convert it from and to several formats
Apache License 2.0
1 stars 0 forks source link

Add findFirst utility method #26

Open x7airworker opened 1 year ago

x7airworker commented 1 year ago

Is your feature request related to a problem? Please describe. When you want to find a value just by the key, but don't care about the structure, you most likely write a recursive method to do that for you. So I think it would be good to include this utility method into the project.

Describe the solution you'd like Basically a recursive method for both AbstractObject and AbstractArray. AbstractElement findFirst(String key) The method should be on AbstractArray as well, because an AbstractArray could contain objects which contain the key I want to search for.

JanHolger commented 1 year ago

This could be implemented as an extension to the query method, maybe by adding a wildcard placeholder to it