//If If you want to iterate over a Map and do some logic for specific keys use this
Map<Integer, String> m= new Map<Integer, String> {1=> 'a', 2=>'b'};
Integer[] n = new Integer[]{};
for (Integer i : m.keySet())
{
n.add(i);
}
Integer j = 0;
for (String s : m.values())
{
if (n[j]== 1) { // 1 here is value of the key, you can use your value
Map<Integer, String> m= new Map<Integer, String> {1=> 'a', 2=>'b'};
Integer[] n = new Integer[]{};
for (Integer i : m.keySet())
{
n.add(i);
}
Integer j = 0;
for (String s : m.values())
{
if (n[j]== 1) { // 1 here is value of the key, you can use your value
//DO something
system.debug(n[j]+' '+s); j++;
}
}