Code example for Map

Methods: containsKey, get, put

0
    protected Map<String, PropertyInfo> properties = new HashMap<String, PropertyInfo>();
    protected Map<String, TypeInfo> types = new HashMap<String, TypeInfo>();
     
    public String getPropertyFromType(String propertyID) {
        ensureProperty(propertyID);
        return properties.get(propertyID).fromTypeID;
    } 
    public String getPropertyToType(String propertyID) {
        ensureProperty(propertyID);
        return properties.get(propertyID).toTypeID;
    } 
    public String[] getIncludedTypeIDs(String typeID) {
        ensureType(typeID);
        return types.get(typeID).includedTypes;
    } 
     
    private void ensureProperty(String propertyID) {
        if (properties.containsKey(propertyID)) {
            return; 
        } 
         
        PropertyInfo info = new PropertyInfo();
        properties.put(propertyID, info);
         
        JSONObject obj = getJson(helperURL + "get_property_data" + propertyID);
        if (obj != null) {
            try { 
                if (!obj.isNull("from")) {