Closed dietzc closed 9 years ago
@dietzc I don't understand the problem. Why should the Keyset be ordered?
@tpietzsch we have implemented two algorithms of which the output depends on the ordering of the incoming labels. Actually, the result is still the same if the labels have different ordering, but the naming of the labels then differs (which makes regression tests hard). However, while writing it appears to me that this is something we should handle on our side, e.g. by sorting the labels on our own. Right?
Have a nice sunday!
@dietzc Yes, you should sort the labels on your end if the order is important.
Hi @tpietzsch,
I just ran into problems in another scenario where the ordering of the returned value so a
hashMap.keySet()
call changed from Java 1.7 to 1.8, in case that thetype
of yourkey
isString
. I quickly checked your implementation at https://github.com/imglib/imglib2-roi/blob/master/src/main/java/net/imglib2/roi/labeling/LabelRegions.java#L108 and here you also just use aHashMap
so this problem may be present in case someone calls https://github.com/imglib/imglib2-roi/blob/master/src/main/java/net/imglib2/roi/labeling/LabelRegions.java#L130.If you want to address this problem in imglib2-roi, we could use a
LinkedHashMap
instead of a simpleHashMap
.Does this make sense?