-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueInterface.java
More file actions
55 lines (50 loc) · 1.29 KB
/
QueueInterface.java
File metadata and controls
55 lines (50 loc) · 1.29 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
49
50
51
52
53
54
55
package com.company;
/**
* Interface detailing the methods required for implementing a queue.
*
* DO NOT EDIT THIS FILE!
*
* @author CS 1332 TAs
* @version 1.0
*/
public interface QueueInterface<T> {
/**
* The initial capacity of a queue with fixed-size backing storage.
*/
public static final int INITIAL_CAPACITY = 10;
/**
* Dequeue from the front of the queue.
*
* This method should be implemented in O(1) time.
*
* @return the data from the front of the queue
* @throws java.util.NoSuchElementException if the queue is empty
*/
T dequeue();
/**
* Add the given data the the queue.
*
* This method should be implemented in (if array-backed, amortized) O(1)
* time.
*
* @param data the data to add
* @throws IllegalArgumentException if data is null
*/
void enqueue(T data);
/**
* Return true if this queue contains no elements, false otherwise.
*
* This method should be implemented in O(1) time.
*
* @return true if the queue is empty; false otherwise
*/
boolean isEmpty();
/**
* Return the size of the queue.
*
* This method should be implemented in O(1) time.
*
* @return number of items in the queue
*/
int size();
}