Retaining all elements common in both Queues

 

import java.util.Iterator;
import java.util.PriorityQueue;

class PriorityQueueRetainAll {
public static void main(String[] args) {
// creating our queue
PriorityQueue<Integer> pq = new PriorityQueue<>();
pq.add(12);
pq.add(13);
pq.add(14);
pq.add(15);
pq.add(16);
pq.add(17);
pq.add(18);
// creating another queue
PriorityQueue<Integer> pq1 = new PriorityQueue<>();
pq1.add(14);
pq1.add(16);
pq1.add(18);
pq1.add(20);

System.out.println("Queue pq and pq1 before invoking retainAll() method");
System.out.println("pq = " + pq);
System.out.println("pq1 = " + pq1);
pq.retainAll(pq1);
System.out.println("after invoking retainAll() method the queue is");
System.out.println("pq = " + pq);

}
}

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