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.
精彩评论