All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com_github_leetcode.ListNode.scala Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package com_github_leetcode

class ListNode(_x: Int = 0, _next: ListNode = null) {
    var next: ListNode = _next
    var x: Int = _x

    override def toString: String = {
        val result = new StringBuilder(x.toString)
        var current = next
        while (current != null) {
            result.append(", ")
            result.append(current.x)
            current = current.next
        }
        result.toString
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy