[ 
https://issues.apache.org/jira/browse/SLING-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13890695#comment-13890695
 ] 

Justin Edelson commented on SLING-3368:
---------------------------------------

A simple solution would be to wrap the map/list object in 
Collections.unmodifyableXXX(). My guess is that the primary use case for these 
additions are for read-only access.

FWIW, I think these additions are useful (at least for read access), especially 
in a scripting context as many scripting languages have native support for maps 
and iterators. I don't share [~fmeschbe] 's sense of fealty to the original 
org.json code :)

> Add toMap & iterable to resp. JSONObject and JSONArray
> ------------------------------------------------------
>
>                 Key: SLING-3368
>                 URL: https://issues.apache.org/jira/browse/SLING-3368
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>            Reporter: Nicolas Peltier
>            Priority: Minor
>         Attachments: 
> [json]_add_other_ways_to_use_JSONArray_and_JSONObject.patch
>
>
> Map JSONObject.toMap and JSONArray implementing Iterable allows better usage 
> of those classes.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to