fix: correct the comments and interface

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-08-05 16:52:51 +02:00
parent 5dd35539a5
commit 1f5f1bee8c
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -2,6 +2,8 @@ import java.util.ArrayDeque;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
// This is the interface that allows for creating nested lists.
// You should not implement it, or speculate about its implementation
interface NestedInteger { interface NestedInteger {
// @return true if this NestedInteger holds a single integer, rather than a nested list. // @return true if this NestedInteger holds a single integer, rather than a nested list.
public boolean isInteger(); public boolean isInteger();
@ -13,23 +15,6 @@ interface NestedInteger {
public List<NestedInteger> getList(); public List<NestedInteger> getList();
} }
/**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* public interface NestedInteger {
*
* // @return true if this NestedInteger holds a single integer, rather than a nested list.
* public boolean isInteger();
*
* // @return the single integer that this NestedInteger holds, if it holds a single integer
* // Return null if this NestedInteger holds a nested list
* public Integer getInteger();
*
* // @return the nested list that this NestedInteger holds, if it holds a nested list
* // Return empty list if this NestedInteger holds a single integer
* public List<NestedInteger> getList();
* }
*/
class NestedIterator implements Iterator<Integer> { class NestedIterator implements Iterator<Integer> {
private class DFSEntry { private class DFSEntry {