News for hackers. Stuff that matters.
Re:Implementation of a RingBuffer in Java with optional FIFO... by IncreasePosts on Wednesday February 05, 2025 @03:11PM (#42954443)
Line 115: this.entries = (T[]) Array.newInstance(type, capacity)

You can't just say new T[capacity] in java.

Re:Implementation of a RingBuffer in Java with optional FIFO... by jcrites on Wednesday February 05, 2025 @03:34PM (#42954712)
True, but you can say `new Object[capacity]` and cast it to type `T[]`.