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-java17 Show documentation
Show all versions of leetcode-in-java17 Show documentation
Java Solution for LeetCode algorithm problems, continually updating
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);
}
}