Recently Used List
Develop a recently-used-list class to hold strings uniquely in Last-In-First-Out order.
- A recently-used-list is initially empty.
- The most recently added item is first, the least recently added item is last.
- Items can be looked up by index, which counts from zero.
- Items in the list are unique, so duplicate insertions are moved rather than added.
Optional extras:
- Null insertions (empty strings) are not allowed.
- A bounded capacity can be specified at construction, so there is an upper limit to the number of items contained, with the least recently added items dropped on overflow.
Acknowledgements
This kata is described on cyber-dojo.org