Examine the following code snippet.  Add the necessary code…

Examine the following code snippet.  Add the necessary code to do the following tasks, in order: Shuffle the airport code names. Add a new airport code (real or fake) to the collection.  Sort the collection in reverse order. Locate the index of the code you added to the collection. Print the contents of the collection, as List objects. Indicate what the output of the program would be once it’s run. import java.util.ArrayList;import java.util.Collections;import java.util.List;public class AirportCodes {    public static void main(String[] args) {        List airportCodes = new ArrayList();        airportCodes.add(“JFK”); // New York        airportCodes.add(“LHR”); // London Heathrow        airportCodes.add(“LAX”); // Los Angeles        airportCodes.add(“HND”); // Tokyo Haneda       //Your code here    }}

Examine the following code snippet.  Add the necessary code…

Examine the following code snippet.  Add the necessary code to do the following tasks, in order: Shuffle the list. Add a new fruit to the list.  You may choose the fruit. Sort the list. Locate the index of “Orange” in the list. Print the list as an array. Indicate what the output of the program would be once it’s run. import java.util.ArrayList;import java.util.Collections;import java.util.List;public class Main{    public static void main(String[] args) {    List fruits = new ArrayList();       fruits.add(“Banana”);       fruits.add(“Mango”);       fruits.add(“Orange”);       fruits.add(“Apple”);                /* your code here */      }

The following image shows the data in the table “Territories…

The following image shows the data in the table “Territories”, which is located in an existing SQLite database. Assume that a student has used the SQL Helper plugin in IntelliJ to connect to this database, the same way you did for your Programming Project 8 assignment.  The code generated by this plugin for the Territores table is shown In the Reference section below. Write some code for the main method that would accomplish the following tasks: Insert a new product into the “Territories” table.  The new Territory must have a RegionID that is not currently present in the table.  You may select the data that goes into each field. Delete a product from the “Territories” table.  Use the last digit of your StudentID number to determine which product is removed.  For example, if your StudentID number is V03329331, delete the first item in the table.  If your ID number ends with a “0”, delete the 10th item in the table. Update the territory ID of the last record shown in the table.  Use the last 5 digits of your student ID to determine the new ID.  For example, if your StudentID number is V03329331, the new territory ID would be 29331. Perform a query to find all items that have a RegionID status of 1.  Print the result as a DefaultTableModel, showing the TerritoryID, TerritoryDescription, and RegionID.  Sort the list in descending order by TerritoryDescription. Print the “Territories” table to the terminal. Reference Code package DBHelper;import javax.swing.table.DefaultTableModel;import java.util.ArrayList;public class Territories extends DBHelper { private final String TABLE_NAME = “Territories”; public static final String TerritoryID = “TerritoryID”; public static final String TerritoryDescription = “TerritoryDescription”; public static final String RegionID = “RegionID”; private String prepareSQL(String fields, String whatField, String whatValue, String sortField, String sort) { String query = “SELECT “; query += fields == null ? ” * FROM ” + TABLE_NAME : fields + ” FROM ” + TABLE_NAME; query += whatField != null && whatValue != null ? ” WHERE ” + whatField + ” = \”” + whatValue + “\”” : “”; query += sort != null && sortField != null ? ” order by ” + sortField + ” ” + sort : “”; return query; } public void insert(String TerritoryID, String TerritoryDescription, Integer RegionID) { TerritoryID = TerritoryID != null ? “\”” + TerritoryID + “\”” : null; TerritoryDescription = TerritoryDescription != null ? “\”” + TerritoryDescription + “\”” : null; Object fields_ar = {Territories.TerritoryID, Territories.TerritoryDescription, Territories.RegionID}; String values = “”, fields = “”; for (int i = 0; i < values_ar.length; i++) { if (values_ar != null) { values += values_ar + ", "; fields += fields_ar + ", "; } } if (!values.isEmpty()) { values = values.substring(0, values.length() - 2); fields = fields.substring(0, fields.length() - 2); super.execute("INSERT INTO " + TABLE_NAME + "(" + fields + ") values(" + values + ");"); } } public void delete(String whatField, String whatValue) { super.execute("DELETE from " + TABLE_NAME + " where " + whatField + " = " + whatValue + ";"); } public void update(String whatField, String whatValue, String whereField, String whereValue) { super.execute("UPDATE " + TABLE_NAME + " set " + whatField + " = \"" + whatValue + "\" where " + whereField + " = \"" + whereValue + "\";"); } public ArrayList select(String fields, String whatField, String whatValue, String sortField, String sort) { return super.executeQuery(prepareSQL(fields, whatField, whatValue, sortField, sort)); } public ArrayList getExecuteResult(String query) { return super.executeQuery(query); } public void execute(String query) { super.execute(query); } public DefaultTableModel selectToTable(String fields, String whatField, String whatValue, String sortField, String sort) { return super.executeQueryToTable(prepareSQL(fields, whatField, whatValue, sortField, sort)); }}