I have started a 30-day Selenium with Java challenge to help beginners and intermediate software testers for learning Selenium and Java concepts. This is the second challenge i have posted. Share your answers in the comments about the program’s output—I’ll provide my short answer afterward.
import java.util.HashMap;
import org.testng.annotations.Test;
import java.util.Map;
public class SampleProgram2 {
@Test
public void testMySkills() {
System.out.println(getMappedItem());
}
public int getMappedItem() {
HashMap<Integer,Integer> map = new HashMap<>();
map.put(5,10);
map.put(9,11);
map.put(2,12);
int i = 0;
for (Map.Entry<Integer,Integer> set:map.entrySet()) {
set.setValue(set.getValue()*10);
}
return map.get(5);
}
}