@Override public ImmutableJsonArray add(final int value, final int... furtherValues) { checkFurtherValues(furtherValues); return add(JsonValue.of(value), Arrays.stream(furtherValues) .mapToObj(JsonValue::of) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final int value, final int... furtherValues) { checkFurtherValues(furtherValues); return add(JsonFactory.newValue(value), Arrays.stream(furtherValues) .mapToObj(JsonFactory::newValue) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final String value, final String... furtherValues) { checkValue(value); checkFurtherValues(furtherValues); return add(JsonFactory.newValue(value), Arrays.stream(furtherValues) .map(JsonFactory::newValue) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final String value, final String... furtherValues) { checkValue(value); checkFurtherValues(furtherValues); return add(JsonValue.of(value), Arrays.stream(furtherValues) .map(JsonValue::of) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final double value, final double... furtherValues) { checkFurtherValues(furtherValues); return add(JsonFactory.newValue(value), Arrays.stream(furtherValues) .mapToObj(JsonFactory::newValue) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final long value, final long... furtherValues) { checkFurtherValues(furtherValues); return add(JsonValue.of(value), Arrays.stream(furtherValues) .mapToObj(JsonValue::of) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final long value, final long... furtherValues) { checkFurtherValues(furtherValues); return add(JsonFactory.newValue(value), Arrays.stream(furtherValues) .mapToObj(JsonFactory::newValue) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final JsonValue value, final JsonValue... furtherValues) { checkValue(value); checkFurtherValues(furtherValues); final List<JsonValue> valuesCopy = copyValues(); valuesCopy.add(value); Collections.addAll(valuesCopy, furtherValues); return of(valuesCopy); }
@Override public ImmutableJsonArray add(final double value, final double... furtherValues) { checkFurtherValues(furtherValues); return add(JsonValue.of(value), Arrays.stream(furtherValues) .mapToObj(JsonValue::of) .toArray(JsonValue[]::new)); }
@Override public ImmutableJsonArray add(final boolean value, final boolean... furtherValues) { checkFurtherValues(furtherValues); final List<JsonValue> valuesCopy = copyValues(); valuesCopy.add(JsonFactory.newValue(value)); for (final boolean furtherValue : furtherValues) { valuesCopy.add(JsonFactory.newValue(furtherValue)); } return of(valuesCopy); }
@Override public ImmutableJsonArray add(final JsonValue value, final JsonValue... furtherValues) { checkValue(value); checkFurtherValues(furtherValues); SoftReferencedValueList extendedValueList = valueList.add(value); for (final JsonValue furtherValue : furtherValues) { extendedValueList = extendedValueList.add(furtherValue); } return new ImmutableJsonArray(extendedValueList); }
@Override public ImmutableJsonArray add(final boolean value, final boolean... furtherValues) { checkFurtherValues(furtherValues); SoftReferencedValueList extendedValueList = valueList.add(JsonValue.of(value)); for (final boolean furtherValue : furtherValues) { extendedValueList = extendedValueList.add(JsonValue.of(furtherValue)); } return new ImmutableJsonArray(extendedValueList); }