com_github_leetcode.NestedInteger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
package com_github_leetcode;
import java.util.ArrayList;
import java.util.List;
public class NestedInteger {
private List list;
private Integer integer;
public NestedInteger() {
this.list = new ArrayList<>();
}
public NestedInteger(List list) {
this.list = list;
}
public NestedInteger(Integer integer) {
this.integer = integer;
}
public boolean isInteger() {
return integer != null;
}
public Integer getInteger() {
return integer;
}
public List getList() {
return list;
}
public void add(NestedInteger nestedInteger) {
this.list.add(nestedInteger);
}
}