Iterating over keys or values using keySet() and values() methods


 import java.util.HashMap;
import java.util.Map;

public class HashMapIteration2 {

public static void main(String[] args) {
//Creating HashMap;
HashMap<Integer, String> hm = new HashMap<>();
//Putting element
hm.put(1, "Naidu");
hm.put(3, "Rohilla");
hm.put(5, "Vijay");
hm.put(2, "Rahul");
hm.put(4, "Ramakesh");
hm.put(6, "Sudeep");
//Storing null value
hm.put(null, null);
System.out.println("Iterating HashMap Using For each loop");
//Iterating over keys
for (Integer i : hm.keySet()) {
System.out.println("Key = " + i);
}
//Iterating over values
for(String str:hm.values()){
System.out.println("Value = "+str);
}
}
}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...