Added a Clear method that resets the read and write indexes.
Thanks for the contribution! One issue with adding a Clear() method like this is that it is not thread safe.
We can solve this by either:
- Adding a note to the javadoc comment
- Creating separate
ClearFromConsumer(),ClearFromProducer()methods
I am not a fan of either approach tbh, as you can also create a new Ring Buffer over the old one. On the other hand I also want the library to be convenient for the people actually using it, so we can go with either of these.
Thanks for the contribution! One issue with adding a
Clear()method like this is that it is not thread safe.We can solve this by either:
- Adding a note to the javadoc comment
- Creating separate
ClearFromConsumer(),ClearFromProducer()methods
I would preffer for the PR to stay open for a while to have time to perhaps get comments from more users, and for me to think about this some more.