@Override public JsonArray build() { List<JsonValue> snapshot; if (valueList == null) { snapshot = Collections.emptyList(); } else { // Should we trim to minimize storage ? // valueList.trimToSize(); snapshot = Collections.unmodifiableList(valueList); } valueList = null; return new JsonArrayImpl(snapshot, bufferPool); }
@Override public boolean getBoolean(int index) { JsonValue jsonValue = get(index); if (jsonValue == JsonValue.TRUE) { return true; } else if (jsonValue == JsonValue.FALSE) { return false; } else { throw new ClassCastException(); } }
@Override public JsonArray build() { List<JsonValue> snapshot; if (valueList == null) { snapshot = Collections.emptyList(); } else { // Should we trim to minimize storage ? // valueList.trimToSize(); snapshot = Collections.unmodifiableList(valueList); } valueList = null; return new JsonArrayImpl(snapshot, bufferPool); }
@Override public int getInt(int index) { return getJsonNumber(index).intValue(); }
@Override public String getString(int index) { return getJsonString(index).getString(); }
@Override public JsonArray build() { List<JsonValue> snapshot; if (valueList == null) { snapshot = Collections.emptyList(); } else { // Should we trim to minimize storage ? // valueList.trimToSize(); snapshot = Collections.unmodifiableList(valueList); } valueList = null; return new JsonArrayImpl(snapshot, bufferPool); }
@Override public String getString(int index) { return getJsonString(index).getString(); }
@Override public int getInt(int index) { return getJsonNumber(index).intValue(); }
@Override public String getString(int index) { return getJsonString(index).getString(); }
@Override public int getInt(int index) { return getJsonNumber(index).intValue(); }
@Override public String getString(int index, String defaultValue) { try { return getString(index); } catch (Exception e) { return defaultValue; } }
@Override public int getInt(int index) { return getJsonNumber(index).intValue(); }
@Override public String getString(int index) { return getJsonString(index).getString(); }
@Override public boolean getBoolean(int index, boolean defaultValue) { try { return getBoolean(index); } catch (Exception e) { return defaultValue; } }
@Override public int getInt(int index, int defaultValue) { try { return getInt(index); } catch (Exception e) { return defaultValue; } }
@Override public JsonArray build() { List<JsonValue> snapshot; if (valueList == null) { snapshot = Collections.emptyList(); } else { // Should we trim to minimize storage ? // valueList.trimToSize(); snapshot = Collections.unmodifiableList(valueList); } valueList = null; return new JsonArrayImpl(snapshot, bufferPool); }
@Override public String getString(int index, String defaultValue) { try { return getString(index); } catch (Exception e) { return defaultValue; } }
@Override public boolean getBoolean(int index, boolean defaultValue) { try { return getBoolean(index); } catch (Exception e) { return defaultValue; } }
@Override public String getString(int index, String defaultValue) { try { return getString(index); } catch (Exception e) { return defaultValue; } }
@Override public boolean getBoolean(int index, boolean defaultValue) { try { return getBoolean(index); } catch (Exception e) { return defaultValue; } }