0
/ 1.0
Use this interface definition to solve this exercise.
public interface ListADT<E> { // returns number of elements stored public int...
Use this interface definition to solve this exercise.
public interface ListADT<E> {
// returns number of elements stored
public int size();
// removes all elements
public void clear();
// return true if list is empty, false otherwise
public boolean isEmpty();
// adds e at the end of the list
public boolean add(E e);
// returns true if o is in the list, false otherwise
public boolean contains(Object o);
// returns the object at index, returns null if
// index is invalid
public E get(int index);
// returns the index of o if it exists, -1 otherwise
public int indexOf(Object o);
}
Write a test method to test the initial conditions of
an object of type List<String>
. The test infrastructure
has an variable named instance
of type List<String>
.
When your test is run, this object has just been allocated.
Write at least 3 asserts (assertTrue()
, assertFalse()
, or
assertEquals()
) to test the initial condition of the
instance
object. You might want to check the size()
,
isEmpty()
and get()
.
Your feedback will appear here when you check your answer.