擅长:python、mysql、java
<p>你是说<code>None</code>不是<code>NULL</code>对吧?你知道吗</p>
<pre><code>def next(self):
"""
:rtype: int
"""
if self.hasNext():
test = self.flattenedList[self.currIdx]
self.currIdx +=1
return test
else:
#return NULL
return None
</code></pre>
<p>通过运行:</p>
<pre><code>nestedList = [[1,1],2,[1,1]]
i, v = NestedIterator(nestedList), []
while i.hasNext(): v.append(i.next())
print v
</code></pre>
<p>我得到了:</p>
<pre><code>[1, 1, 2, 1, 1]
</code></pre>
<p>所以,除了把NULL改成None,我不知道。你知道吗</p>