com.github.davidmoten.oas3.internal.Util Maven / Gradle / Ivy
package com.github.davidmoten.oas3.internal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
public final class Util {
private Util() {
// prevent instantiation
}
public static Map nullMapToEmpty(Map map) {
if (map == null) {
return Collections.emptyMap();
} else {
return map;
}
}
public static List nullListToEmpty(List list) {
if (list == null) {
return Collections.emptyList();
} else {
return list;
}
}
public static Optional> first(Map map) {
return map.entrySet().stream().findFirst();
}
public static String quote(String s) {
return "\"" + s + "\"";
}
}