-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListADT.java
75 lines (65 loc) · 1.79 KB
/
ListADT.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.Iterator;public interface ListADT<T> extends Iterable<T>{ /**
* Removes and returns the first element from this list.
*
* @return the first element from this list
*/ public T removeFirst (); /**
* Removes and returns the last element from this list.
*
* @return the last element from this list
*/ public T removeLast (); /**
* Removes and returns the specified element from this list.
*
* @param element the element to be removed from the list
*/ public T remove (T element); /**
* Returns a reference to the first element in this list.
*
* @return a reference to the first element in this list
*/ public T first (); /**
* Returns a reference to the last element in this list.
*
* @return a reference to the last element in this list
*/ public T last (); /**
* Returns true if this list contains the specified target element.
*
* @param target the target that is being sought in the list
* @return true if the list contains this element
*/ public boolean contains (T target); /**
* Returns true if this list contains no elements.
*
* @return true if this list contains no elements
*/ public boolean isEmpty(); /**
* Returns the number of elements in this list.
*
* @return the integer representation of number of elements in this list
*/ public int size(); /**
* Returns an iterator for the elements in this list.
*
* @return an iterator over the elements in this list
*/ public Iterator<T> iterator(); /**
* Returns a string representation of this list.
*
* @return a string representation of this list
*/ public String toString();}