-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedListADT.java
More file actions
35 lines (26 loc) · 1.11 KB
/
Copy pathLinkedListADT.java
File metadata and controls
35 lines (26 loc) · 1.11 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
package dataStructure;
/*
* Author: Ri Xin Yang
* Date: April 19, 2019
* Desc: This interface specifies the requirements of a LinkedList. This is to be implemented by the main file of
* LinkedList.
*/
interface LinkedListADT<T> {
// Returns true if the linked list has no nodes, or false otherwise.
public boolean isEmpty();
// Deletes all of the nodes in the linked list.
public void clear();
// Returns the number of nodes in the linked list
public int size();
// Adds a node to the front of the linked list.
public void addFirst(T element);
// Returns a reference to the data in the first node, or null if the list is empty.
public T peekFirst();
// Removes a node from the front of the linked list (if there is one).
// Returns a reference to the data in the first node, or null if the list is empty.
public T removeFirst();
// Returns true if the linked list contains a certain element, or false otherwise.
public boolean contains(T key);
// Return String representation of the linked list.
public String toString();
}