mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-13 15:53:49 +00:00
13 lines
305 B
Kotlin
Vendored
13 lines
305 B
Kotlin
Vendored
class Stack<T> : IPushPop<T> {
|
|
private val data = ArrayList<T>();
|
|
|
|
override fun push(item : T) {
|
|
data.add(item) // Problem: I would like to write push(...) = data.add(...), but the types do not match
|
|
}
|
|
|
|
override fun pop() = data.removeLast()
|
|
|
|
override val isEmpty
|
|
get() = data.isEmpty
|
|
|
|
} |