Package dsa.lab02.base
Interface Container<Item>
- Type Parameters:
Item
- the item type
- All Superinterfaces:
Iterable<Item>
- All Known Subinterfaces:
DynamicSequence<Item>
,LinkedList<Item>
,Queue<Item>
,Stack<Item>
,StaticSequence<Item>
- All Known Implementing Classes:
ArrayQueue
,ArrayQueue
,ArrayStack
,ArrayStack
,CircularDynamicArray
,CircularDynamicArray
,DoublyLinkedList
,DoublyLinkedList
,DynamicArray
,DynamicArray
,LinkedQueue
,LinkedQueue
,LinkedStack
,LinkedStack
,SinglyLinkedList
,SinglyLinkedList
,StaticArray
,StaticArray
A container.
Something that contains some number of items, not necessarily in any particular order.
-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
size
int size()Get the number of contained items.- Returns:
- the size
-
isEmpty
default boolean isEmpty()Check if it's empty.- Returns:
- whether there are no items
-
contains
Check if the given item is equal to any of those contained.- Parameters:
item
- the item to check for membership- Returns:
- whether such an item is contained
-
items
Get an iterable that yields each item once.- Returns:
- an iterable over the items
-
iterator
-