class JavaxJson {

    public static <R> List<R> mapObjectValues(final JsonObject jsonObject,
                                              final BiFunction<String, JsonObject, R> mapBiFunction,
                                              final boolean discardNulls) {
        return Optional.ofNullable(jsonObject).orElse(JsonValue.EMPTY_JSON_OBJECT).entrySet().stream()
                .filter(Fun.testValue(value -> value.getValueType() == JsonValue.ValueType.OBJECT))
                .map(Fun.mapValue(JsonValue::asJsonObject))
                .map(Fun.mapEntry(mapBiFunction))
                .filter(discardNulls ? Objects::nonNull : elem -> true)
                .collect(Collectors.toList());
    }

    private  JavaxJson();

}