HashSet.remove() and Iterator.remove() not working

前端 未结 10 1525
借酒劲吻你
借酒劲吻你 2020-12-13 00:32

I\'m having problems with Iterator.remove() called on a HashSet.

I\'ve a Set of time stamped objects. Before adding a new item to the Set, I loop through the set, i

10条回答
  •  猫巷女王i
    2020-12-13 00:48

    The Java HashSet has an issue in "remove()" method. Check the link below. I switched to TreeSet and it works fine. But I need the O(1) time complexity.

    https://bugs.openjdk.java.net/browse/JDK-8154740

提交回复
热议问题