I get String value from client and if this value does not fit my parameters I add this value to my Set<String>
. And every 10 min in scheduled method I get this values and try perform actions on them and remove from Set. I need Set in which I write and read values. Wrute one methos and read another method. I need cuncurent Set or queue for it.
I try this:
private CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<>();
But I found that CopyOnWriteArrayList has large overhead. How can I write and read String values in java the object of a joint access?