Skip to content

Commit bce68f6

Browse files
author
Boris Testov
authored
Update Solution.kt 2E
1 parent 36a51fb commit bce68f6

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

kotlin/sprint2/E/Solution.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
// <template>
2-
class Node<V> {
3-
var value: V
4-
var next: Node<V>?
5-
var prev: Node<V>?
6-
7-
constructor(value: V) {
8-
this.value = value
9-
next = null
10-
prev = null
2+
class Node<V>(var value: V) {
3+
var next: Node<V>? = null
4+
var prev: Node<V>? = null
5+
6+
fun hasNext(): Boolean {
7+
return next != null
118
}
129
}
1310
// <template>
@@ -41,4 +38,4 @@ fun test() {
4138
assert(node1?.next === node0)
4239
assert(node1?.prev === node2)
4340
assert(node0?.prev === node1)
44-
}
41+
}

0 commit comments

Comments
 (0)