Interface CustomCollection<E>
- All Superinterfaces:
Iterable<E>
Interface that simulates the beheviour of the Collection interface in Java.
This interface acts as a supertype for all the types of queue used in the station, like FIFO, LIFO, Priority
- Author:
- Lorenzo Torri Date: 25-mar-2024 Time: 13.10
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a new element to the Collection, how to add and where to add it, it will be handled by the classes that implements this interfacefirst()Retrieve the first element of the Collectioniterator()This is the method of the Iterable<E> interface, needed for iterating over the CollectionbooleanRemove the head of the CollectionbooleanRemove the Object o from the list.intsize()Get the size of the CollectionMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
addNew
Add a new element to the Collection, how to add and where to add it, it will be handled by the classes that implements this interface- Parameters:
o- Object to add- Returns:
- true if the adding was successful
-
removeHead
boolean removeHead()Remove the head of the Collection- Returns:
- true if the head is removed correctly
-
first
Object first()Retrieve the first element of the Collection- Returns:
- the first element of the Collection, null otherwise
-
iterator
-
size
int size()Get the size of the Collection- Returns:
- size of the collection
-
removeObject
Remove the Object o from the list. Used for specific cases like BoxStation in PS that has to remove the job from the queue- Parameters:
o- the object- Returns:
- true if it has removed the object correctly
-