Skip to content

Commit eca0a4c

Browse files
committed
Some clean up
1 parent b211778 commit eca0a4c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

contents/stacks_and_queues/code/kotlin/Queue.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Queue<T> {
1717
} else list[0]
1818
}
1919

20-
fun size(): Int = return list.size
20+
fun size(): Int = list.size
2121
}
2222

2323
fun main(args: Array<String>) {

contents/stacks_and_queues/code/kotlin/Stack.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
class Stack<T> {
2-
private val stack = mutableListOf<T>()
2+
private val list = mutableListOf<T>()
33

44
fun push(item: T) {
5-
stack.add(item)
5+
list.add(item)
66
}
77

88
fun pop(): T? {
9-
return if (stack.isEmpty()) {
9+
return if (list.isEmpty()) {
1010
null
11-
} else stack.removeAt(stack.size - 1)
11+
} else list.removeAt(list.size - 1)
1212
}
1313

14-
fun size(): Int = return stack.size
14+
fun size(): Int = list.size
1515

1616
fun top(): T? {
17-
return if (stack.isEmpty()) {
17+
return if (list.isEmpty()) {
1818
null
19-
} else stack[stack.size - 1]
19+
} else list[list.size - 1]
2020
}
2121
}
2222

0 commit comments

Comments
 (0)