-1

I have created a method that return me a Map which is singleton Map as below

@Override
protected Map<String,String> getFavTypeCd()
{
   final Map<String,String> favType = Collections.singletonMap("1","first");
   return favType;
}

I was looking for a way , that I could extract the value for the above Map without iterating. Any ideas or suggestions.

user1993412
  • 802
  • 2
  • 15
  • 29

1 Answers1

0

Yes , the easiest is to directly make use of the key to get value

 favTypeCd.get("1") returns "First"
user1993412
  • 802
  • 2
  • 15
  • 29