yahoo / Oak

A Scalable Concurrent Key-Value Map for Big Data Analytics
Apache License 2.0
268 stars 48 forks source link

clear() throws java.lang.UnsupportedOperationException: remove #173

Open maxim5 opened 3 years ago

maxim5 commented 3 years ago

Create a map and call .clear():

java.lang.UnsupportedOperationException: remove

    at java.base/java.util.Iterator.remove(Iterator.java:102)
    at java.base/java.util.AbstractCollection.clear(AbstractCollection.java:431)
    at java.base/java.util.AbstractMap.clear(AbstractMap.java:297)
sanastas commented 3 years ago

Indeed those optional APIs are not yet implemented. They are on the TODO list. Meanwhile instead of Iterator.remove() it is possible to use an iterator and invoke remove() on relevant key-value mapping. For clear() there is no good alternative. Using close() and building again will release the entire off-heap memory and allocate again.