-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
scala/scala
#10003Description
Reproduction steps
Scala version: 2.13.x
def main(args: Array[String]): Unit = {
val map: ConcurrentSkipListMap[Int, Int] = new ConcurrentSkipListMap[Int, Int]();
map.put(1, 1);
map.put(2, 3);
map.put(3, 4);
val subMap = map.subMap(1, 3)
val values = subMap.values().asScala
// Thead-A
values.lastOption.get
// Thead-B
map.clear()
}
it will occur under specific circumstances....... (Not necessarily)
Problem
when i use concurrent data structure, Iterable#lastOption maybe throw NoSuchElementException
According to the note of method, it did not declare will throw NoSuchElementException. i think we should avoid that
Reactions are currently unavailable
