Searching a Key and finding value associated with it in a TreeMap

 

import java.util.Scanner;
import java.util.TreeMap;

public class MapTreeContainKey {

public static void main(String[] args) {
//creating our tree map
TreeMap<Integer, String> tm = new TreeMap<>();
//Inserting element in our TreeMap
tm.put(17, "this");
tm.put(13, "Invent");
tm.put(18, "blog");
tm.put(16, "on");
tm.put(15, "you");
tm.put(14, "welcomes");
tm.put(12, "Java");

Scanner sc = new Scanner(System.in);
System.out.println("Enter the key you want to search");
Integer key = sc.nextInt();

if (tm.containsKey(key)) {
System.out.println("Key is present and value associated with it is : ");
System.out.println(tm.get(key));
} else {
System.out.println("key not found");
}
}
}

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...