Customized Sorting of an Arraylist of String using Stream

 

import java.util.ArrayList;
import java.util.List;
import java.util.stream.*;

public class StreamCustSort1 {

  public static void main(String[] args) {
    ArrayList<String> actress = new ArrayList<>();
    actress.add("Sunny");
    actress.add("Kajal");
    actress.add("Anushka");
    actress.add("Mallika");
    actress.add("Aamna");
    actress.add("Tara");
    actress.add("Katrina");

    List<String> sortedList1 = actress
      .stream()
      .sorted()
      .collect(Collectors.toList());
    System.out.println("Sorted List : " + sortedList1);
    System.out.println("-------------------------------------------------");
    List<String> sortedList2 = actress
      .stream()
      .sorted((s1, s2) -> s2.compareTo(s1))
      .collect(Collectors.toList());
    System.out.println("Sorted List : " + sortedList2);
  }
}

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