Develop a recently-used-list class to hold strings uniquely in Last-In-First-Out order.
- 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.
- A recently-used-list is initially empty.
- The Recently Used List reports size equal to the number of items in the list.
(Source: https://github.com/garora/TDD-Katas)
interface RecentlyUsedList {
val size: Int
operator fun get(i: Int) : String
fun insert(element: String)
}
- Import the project in IntelliJ
- Click Import Project
- Open the
build.gradle
file - Select "Use Auto-import" to make your life easier
- Open
src/test/kotlin/RecentlyUsedListTest.kt
- Run the JUnit test in the file