Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need a java ArrayList Interface class without using the built-in ArrayList class

ID: 3758029 • Letter: N

Question

Need a java ArrayList Interface class without using the built-in ArrayList class! Use the methods defined below and use the driver that is provided. If new methods are needed to complete the class than it's ok to add them!

Methods:

• void insert( Object, int index ) // Adds object ay the specified index

• Object remove(int index) // Remove and return the object at the specified index

• int size()

• String toString()

• boolean isEmpty()

• int indexOf(Object) // Returns -1 if not found

• boolean equals(Object) // Compares sizes and elements in the data structure

• Object get(int index) // Returns the object at index specified.

Driver:

public class ArrayListDriver {

public static void main( String[] args ) {

ArrayList a = new ArrayList();
a.insert( 'B', 0 );
a.insert( 'a', 0 );
a.insert( 't', 1 );
System.out.println( a.toString() );
  while( a.isEmpty() == false ) {
System.out.println(a.remove( 0 ) );
}

}

}

Explanation / Answer

public class ArrayListDriver {

public static void main( String[] args ) {

ArrayList a = new ArrayList();
a.insert( 'B', 0 );
a.insert( 'a', 0 );
a.insert( 't', 1 );
System.out.println( a.toString() );
  while( a.isEmpty() == false ) {
System.out.println(a.remove( 0 ) );
}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote