Finding if a specific element in stored in the Queue or not

 

import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

public class PriorityQueueContains {
// method to find the element in the given set
public static void is_Contains(PriorityQueue<String> pq) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the element you want to search");
String str = sc.nextLine();
if (pq.contains(str)) {
System.out.println("Element is present in the given Set");
} else {
System.out.println("Element is not present in the given set");
}
}

// method to find the complete set in another set
public static void is_Contains(PriorityQueue<String> pq1, PriorityQueue<String> pq2) {

if (pq1.containsAll(pq2)) {
System.out.println("pq2 is present in pq1");
} else {
System.out.println("pq2 is not present in pq1");
}
}

public static void main(String[] args) {
// creating our PriorityQueue
PriorityQueue<String> pq = new PriorityQueue<>();
// adding element to our set
// insertion order is maintained here
pq.add("Neha");
pq.add("Nisha");
pq.add("Nishu");
pq.add("Rekha");
pq.add("Madhu");
pq.add("Disha");
pq.add("Tara");
pq.add("Tara"); // duplicate element can't be added

// creating another PriorityQueue
PriorityQueue<String> pq1 = new PriorityQueue<>();
pq1.add("Reena");
pq1.add("Sweety");
pq1.add("Sheetal");
// creating another PriorityQueue
PriorityQueue<String> pq2 = new PriorityQueue<>();
pq2.add("Nisha");
pq2.add("Nishu");
pq2.add("Rekha");
pq2.add("Madhu");
pq2.add("Disha");

// is_Contains(pq);
is_Contains(pq, pq1);
is_Contains(pq, pq2);

}
}

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