//Create the reverse the map for (Map.Entry<Integer, String> entry : idToValue.entrySet()) { valueToId.put(entry.getValue(), entry.getKey()); } //Value List sort alphabetically valueList.addAll(idToValue.values()); Collections.sort(valueList);
Get Id for Valueparamvaluereturn return valueToId.get(value);
return valueToId.get(value);
Get value for Idparamidreturn return idToValue.get(id);
return idToValue.get(id);