com_github_leetcode.NestedInteger.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-kotlin Show documentation
Show all versions of leetcode-in-kotlin Show documentation
Kotlin-based LeetCode algorithm problem solutions, regularly updated
package com_github_leetcode
class NestedInteger {
private var list: MutableList? = null
private var integer: Int? = null
constructor() {
list = ArrayList()
}
constructor(list: MutableList?) {
this.list = list
}
constructor(integer: Int?) {
this.integer = integer
}
fun isInteger(): Boolean {
return integer != null
}
fun getInteger(): Int? {
return integer
}
fun getList(): List? {
return list
}
fun add(nestedInteger: NestedInteger) {
list!!.add(nestedInteger)
}
}