All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.davidmoten.oas3.internal.Util Maven / Gradle / Ivy

There is a newer version: 0.1.30
Show newest version
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 + "\"";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy