Hi,
I am getting an odd exception when iterating across values with fastutil 7.0.13 on an Int2ObjectOpenHashSet which appears to be a problem in the fastutil implementation.
I have a nice simple loop of:
Iterator<Object> i = map.values.iterator();
while (i.hasNext()) { System.out.println(i.next()) }
but I am getting a:
[java] Caused by: java.lang.NullPointerException
[java] at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap$MapIterator.nextEntry(Int2ObjectOpenHashMap.java:730)
[java] at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap$ValueIterator.next(Int2ObjectOpenHashMap.java:1033)
which appears to be from:
final int k = wrapped.getInt(-pos - 1);
but wrapper is documented as:
/**
* A lazily allocated list containing keys of entries that have wrapped
* around the table because of removals.
*/
and I have not been invoking remove and therefore wrapper has not been allocated hence the NPE.
so there is some situation where...
...is true despite not having invoked remove() on the iterator().
after this point I am getting other weird errors on the rehash functionality like:
java.lang.ArrayIndexOutOfBoundsException: -1
at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.rehash(Int2ObjectOpenHashMap.java:1167)
at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.insert(Int2ObjectOpenHashMap.java:346)
at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.put(Int2ObjectOpenHashMap.java:353)
so obviously something has got really confused. I have the map in question protected by a ReadWriteLock so there are no concurrent writes. Can you think of anything that I might be doing to provoke this behaviour, and what further information would be useful to help diagnose the problem?
many thanks
Alex