Java Json Get getIntegerArrayList(JsonArray array)

Here you can find the source of getIntegerArrayList(JsonArray array)

Description

get Integer Array List

License

Apache License

Declaration

public static ArrayList<Integer> getIntegerArrayList(JsonArray array)
        throws ClassCastException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import javax.json.JsonArray;

import javax.json.JsonNumber;

import javax.json.JsonValue;

public class Main {

    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());
        }//w  ww.ja  v a2s .  c om

        return res;
    }
}

Related

  1. getBoolean(JsonObject json, String name)
  2. getBooleanValue(JsonValue value)
  3. getBuilderFactory()
  4. getInt(JsonObject json, String name)
  5. getIntArray(JsonObject object, String name)
  6. getIntegerArrayListSansDoublons( JsonArray array)
  7. getJsonArray(JsonObject object, String name)
  8. getJsonIntArray(Iterable integers)
  9. getJsonNumberOrNull(JsonObject object, String key)