Getting first and last element of a LinkedList using Peek Method

 

import java.util.LinkedList;

public class LinkedListPeek {

public static void main(String[] args) {
LinkedList<String> ll = new LinkedList<>();
LinkedList<String> ll1 = new LinkedList<>();

//addding element to linkedlist ll
ll.add("Ishu");
ll.add("Nishu");
ll.add("Naina");
ll.add("Nishu");
ll.add("Shiksha");
System.out.println("The original list is : " + ll);

System.out.println(ll.peek()); //return first element
System.out.println(ll.peekFirst()); //return first element
System.out.println(ll.peekLast()); //return last element

//return null as the LinkedList is empty
System.out.println(ll1.peek());
System.out.println(ll1.peekFirst());
System.out.println(ll1.peekLast());
}
}

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