List of usage examples for io.vertx.core MultiMap isEmpty
boolean isEmpty();
From source file:co.runrightfast.core.utils.VertxUtils.java
License:Apache License
static JsonObject toJsonObject(@NonNull final MultiMap map) { if (map.isEmpty()) { return EMPTY_OBJECT; }/* w w w. j ava 2s . com*/ final JsonObjectBuilder json = Json.createObjectBuilder(); map.names().stream().forEach(name -> { final List<String> values = map.getAll(name); if (values.size() == 1) { json.add(name, values.get(0)); } else { json.add(name, JsonUtils.toJsonArray(values)); } }); return json.build(); }