Java Reference
In-Depth Information
A
BSTRACT
D
ATA
T
YPE
: Q
UEUE
D
ATA
•
A collection of objects in a specific order and having the same data type
•
The number of objects in the collection
O
PERATIONS
P
SEUDOCODE
UML
D
ESCRIPTION
add(newEntry)
+add(newEntry: T): void
Task: Adds
newEntry
to the end of
the list.
Input:
newEntry
is an object.
Output: None.
add(newPosition, newEntry)
+add(newPosition: integer,
newEntry: T): void
Task: Adds
newEntry
at position
newPosition
within the list.
Position 1 indicates the first
entry in the list.
Input:
newPosition
is an integer,
newEntry
is an object.
Output: None.
remove(givenPosition)
+remove(givenPosition: integer): T
Task: Removes and returns the entry
at position
givenPosition
.
Input:
givenPosition
is an integer.
Output: None.
clear()
+clear(): void
Task: Removes all entries from the list.
Input: None.
Output: None.
replace(givenPosition,
newEntry)
+replace(givenPosition: integer,
newEntry: T): void
Task: Replaces the entry at position
givenPosition
with
newEntry
.
Input:
givenPosition
is an integer,
newEntry
is an object.
Output: None.
getEntry(givenPosition)
+getEntry(givenPosition: integer): T
Task: Retrieves the entry at position
givenPosition
.
Input:
givenPosition
is an integer.
Output: Returns the entry at position
givenPosition
.