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

com.delivereo.org.enums.City Maven / Gradle / Ivy

package com.delivereo.org.enums;

import java.util.HashMap;
import java.util.Map;

public enum City {
    QUITO("cities.ecuador.pichincha.quito"),
    GUAYAQUIL("cities.ecuador.guayas.guayaquil");

    //Lookup table
    private static final Map lookup = new HashMap<>();

    //Populate the lookup table on loading time
    static {
        for (City env : City.values()) {
            lookup.put(env.getUrl(), env);
        }
    }

    private String value;

    City(String value) {
        this.value = value;
    }

    //This method can be used for reverse lookup purpose
    public static City get(String url) {
        return lookup.get(url);
    }

    public String getUrl() {
        return value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy