Package model.estrutura
Class DataList
java.lang.Object
model.estrutura.DataList
Represents a FIFO (First-In-First-Out) data structure implemented as a linked list.
This class provides operations to write data to the end of the list and read data
from the beginning, following the queue principle.
The implementation maintains references to both head and tail nodes for efficient append operations.
- Since:
- 2024
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
Constructor Details
-
DataList
public DataList()Constructs an empty DataList. Both head and last references are initialized to null.
-
-
Method Details
-
writeData
Writes (appends) the specified data to the end of the FIFO queue. If the list is empty, the new data becomes both head and last. Otherwise, it's appended after the current last node.- Parameters:
data
- the string data to be added to the queue
-
readData
Reads and removes the data from the beginning of the FIFO queue. Returns "empty.!." if the queue is empty. Following FIFO principle, the first element added is the first one removed.- Returns:
- the data from the beginning of the queue, or "empty.!." if the queue is empty
-