Here you can find the source of getIntegerArrayListSansDoublons( JsonArray array)
public static ArrayList<Integer> getIntegerArrayListSansDoublons( JsonArray array) throws ClassCastException
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.HashSet; import javax.json.JsonArray; import javax.json.JsonNumber; import javax.json.JsonValue; public class Main { public static ArrayList<Integer> getIntegerArrayListSansDoublons( JsonArray array) throws ClassCastException { ArrayList<Integer> resDoublons = getIntegerArrayList(array); HashSet<Integer> set = new HashSet<Integer>(resDoublons.size()); set.addAll(resDoublons);/*from w w w. j a v a2 s . c o m*/ return new ArrayList<Integer>(set); } public static ArrayList<Integer> getIntegerArrayList(JsonArray array) throws ClassCastException { ArrayList<Integer> res = new ArrayList<Integer>(array.size()); for (JsonValue v : array) { res.add(((JsonNumber) v).intValue()); } return res; } }