开发者

Null pointer exception on .iterator() call

I'm getting a strange NullPointerException, evidently thrown by the following line of code:

Iterator<Note> it = notes.iterator();
开发者_开发技巧

I've checked, and at the time the java.util.TreeSet notes is always non-null (with 15 elements). The TreeSet API says nothing about iterator() throwing NullPointerExceptions. What else could be going here?


If notes is not null then:

  • You are mistaken (never discount this option).
  • The implementation of notes is broken.
  • You are using the implementation incorrectly - for instance having multiple threads access it at once.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜