Get the latest tech news
Implementation of a RingBuffer in Java with optional FIFO like semantics
Java 8 Collection Utilities. Contribute to evolvedbinary/j8cu development by creating an account on GitHub.
Ordered mode is useful for when you want to keep a buffer of the most recent N objects, and you need to read them back from oldest to newest. The RingBuffer can be clear ed which removes references to all entries and resets its state, or it can just be reset whereby any entry references are maintained but could be overwritten in future on subsequence calls to put. One reason this can be useful would be if you would like to get and/or be notified the next n entries within some sort of window (e.g. time frame or event space).
Or read this on Hacker News