-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterfaceLL.java
More file actions
45 lines (38 loc) · 1.18 KB
/
Copy pathInterfaceLL.java
File metadata and controls
45 lines (38 loc) · 1.18 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
package com.example;
public interface InterfaceLL<T> {
/**
* Adds an element to the list.
* @param element the element to add
*/
public void add(T element);
/**
* Removes an element at the specified index from the list.
* @param index the index of the element to remove
* @throws IndexOutOfBoundsException if the index is invalid or out of bounds
* @throws IllegalStateException if the list is empty
*/
public T remove(int index);
/**
* Returns head node data in the list without removing it.
* @return the first element
* @throws IllegalStateException if the list is empty
*/
public T getHead();
/**
* Returns the tail node data in the list without removing it.
* @return the last element
* @throws IllegalStateException if the list is empty
*/
public T getTail();
/**
* Returns the number of elements in the list.
* @return the size of the list
*/
public int size();
/**
* Checks if the list is empty.
*
* @return true if the list is empty, false otherwise
*/
public boolean isEmpty();
}