Question: import org.javatuples.Pair; / * * * Abstract * @param Generic type * / public abstract class MyAbstractList implements MyList { / * * * The
import org.javatuples.Pair;
Abstract
@param Generic type
public abstract class MyAbstractList implements MyList
The size of the list.
protected int size ;
Create a default list
protected MyAbstractList
Create a list from an array of objects
@param objects Array of the specified generic type
protected MyAbstractListE objects
for E object : objects
setsizeobject;
Return true if this list contains no elements
public boolean isEmpty
return size ;
Return the number of elements in this list
public int size
return size;
This method determines whether an element is in the list or not.
In the process of searching the list, it will keep a tally of comparisons ie steps it makes
to find the given element. It returns a Pair containing a boolean, which expresses whether the
element was found true or not false and an integer value showing the number of comparisons it took
@param e element to be search for in the list
@return pair containing a boolean and int. Boolean should be true if element is found. False otherwise.
The number of comparisouns made to reach either conclusion is the integer
public Pair containsE e
return new Pairfalse;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
