apatrida
02/25/2016, 11:45 AMvar tail = head.get()
while (true) {
val next = tail.next
if (next == null) {
return tail
}
tail = next
}
isn’t that just:
generateSequence(head.get(), { it.next }).last()
or:
var tail = head.get()
while (true) { tail = tail.next ?: return tail }