Question: Use Java 8 import java.util.ArrayList; import java.util.Collection; public class ArrayListConstructor { public ArrayList createEmptyArrayList() { /* TODO: Construct an empty ArrayList and return it */

Use Java 8

Use Java 8 import java.util.ArrayList; import java.util.Collection; public class ArrayListConstructor { public

import java.util.ArrayList; import java.util.Collection; public class ArrayListConstructor { public ArrayList createEmptyArrayList() { /* TODO: Construct an empty ArrayList and return it */ public ArrayList createAnArrayListWithTwoElements() { * * TODO 1: Create an ArrayList which contain String elements. * TODO 2: Add two String elements to the ArrayList. "Jack" and "Daniel" * TODO 3: Return the ArrayList * public ArrayList createCopyOfAnArrayList(Collection tocopy) { * TODO: Make a copy of the parameter "toCopy" and return it * Hint: Use the constructor provided above public ArrayList createAnArrayListWithCapacity (int capacity) { * TODO: Construct an ArrayList with an initial capacity specified by parameter capacity * The ArrayList should only be able to contain Integers public ArrayList remove TheFirstElementOfAnArrayList(ArrayList input) { /* TODO: Remove the first element (index 0) of the ArrayList input and return it. */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!