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).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Java

Java

Photo of implementation

implementation

Photo of Semantics

Semantics

Related news:

News photo

Compiling Java into native binaries with Graal and Mill

News photo

Swift for C++ Practitioners: Move Semantics

News photo

Should First-Year Programming Students Be Taught With Python and Java?