-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCircularListADT.java
More file actions
48 lines (32 loc) · 1.39 KB
/
CircularListADT.java
File metadata and controls
48 lines (32 loc) · 1.39 KB
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
43
44
45
46
47
48
import java.util.Iterator;
public interface CircularListADT<E> extends Iterable<E> {
public static final int MAXIMUM = 200;
// Inserts an object before the first item
public boolean insertFirst(E obj);
// Inserts an object after the last item
public boolean insertLast(E obj);
// Deletes the first item and returns it
public E deleteFirst();
// Deletes the last item and returns it
public E deleteLast();
// Deletes the specefied object, returns it and shifts the remaining objects
public E delete(E obj);
// Returns the current number of objects in the list
public int size();
// Returns true if nothing exists in the list
public boolean isEmpty();
// Returns true if the list is at maximum capacity
public boolean isFull();
// Returns the first object in the list
public E first();
// Returns the last object in the list
public E last();
// Returns true if the specified object exists in the list
public boolean contains(E obj);
// Returns the specified object if it exists in the list, null if it doesn't
public E search(E obj);
// Restores the list to its initial state
public void reset();
// Returns the iterator of the list
public Iterator<E> iterator();
}