I try to do it in the following way:
public String getValue(String service, String parameter) {
String inputKey = service + ":" + parameter;
Set keys = name2value.keySet();
Iterator itr = keys.iterator();
while (itr.hasNext()) {
if (inputKey.equal(itr.next())) {
return name2value.get(inputKey);
}
return "";
}
}
And I get an error message: cannot find symbol method.equal(java.lang.Object).
I think it is because itr.next() is not considered as a string. How can I solve this problem? I tried to replace Set keys
by Set<String> keys
. It did not help.