Package dsa.lab02.base
Interface Container<Item>
- Type Parameters:
Item
- the item type
- All Superinterfaces:
Iterable<Item>
- All Known Subinterfaces:
DynamicSequence<Item>
,LinkedList<Item>
,Map<Key,
,Value> OrderedMap<Key,
,Value> PriorityQueue<Priority,
,Item> Queue<Item>
,Stack<Item>
,StaticSequence<Item>
- All Known Implementing Classes:
ArrayMap
,ArrayMap
,ArrayPriorityQueue
,ArrayPriorityQueue
,ArrayQueue
,ArrayQueue
,ArrayStack
,ArrayStack
,AVLTree
,AVLTree
,BinaryHeapPriorityQueue
,BinaryHeapPriorityQueue
,BinarySearchTree
,BinarySearchTree
,BinaryTree
,BinaryTree
,ChainingHashMap
,ChainingHashMap
,CircularDynamicArray
,CircularDynamicArray
,DirectedGraph
,DirectedGraph
,DoublyLinkedList
,DoublyLinkedList
,DynamicArray
,DynamicArray
,LinkedQueue
,LinkedQueue
,LinkedStack
,LinkedStack
,ProbingHashMap
,ProbingHashMap
,SinglyLinkedList
,SinglyLinkedList
,SortedArrayMap
,SortedArrayMap
,SortedArrayPriorityQueue
,SortedArrayPriorityQueue
,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
-