I'm trying to find best way to convert List of Integers to JSONArray of org.json.JSONArray library for API call. For that purpose I'm trying to implement stream() methods of Java 8.
Given
List<Integer> ids = new ArrayList<>();
ids.add(1);
ids.add(2);
ids.add(3);
Needed JSONArray object
JSONArray ids = [1,2,3]
with using stream() method in Java.