Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8960011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:34:38+00:00 2026-06-15T15:34:38+00:00

Possible Duplicate: Size-limited queue that holds last N elements in Java Java – Ring

  • 0

Possible Duplicate:
Size-limited queue that holds last N elements in Java
Java – Ring Buffer

I am interested in a bounded above queue, that whenever faced with object insertion, would remove the oldest object first, if the insertion would result in ‘overflowing’. I want the addition to be O(1) and the memory usage as little as possible. I was thinking about either overriding add method on LinkedList, but ideally I would implement a circular, array based list, with catching front/back pointer. Whenever the addition is made over capacity, front pointer advances, and then the back one. Is there an implementation similar to this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:34:39+00:00Added an answer on June 15, 2026 at 3:34 pm

    A linked list is a waste of memory, since the next pointer uses mem, that the ArrayList does not.

    The performant implementations are based on ArrayList or better on an array.
    If your circular buffer size is fixed, you would use an array.

    I implemented a circular buffer using an internal array, with start and end position index vars. I did not found an implemnetation of a circular list / buffer, that did that what i wanted.

    It was not dificullt to implement, but i recomend using a high number of unit test cases, to prove that your circ buffer works as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Size-limited queue that holds last N elements in Java Does java include
Possible Duplicate: In Java, what is the best way to determine the size of
Possible Duplicate: adjusting eclipse console size I am trying to debug an app that
Possible Duplicate: Is it possible to dynamically change maximum java heap size? I know
Possible Duplicate: Size of a byte in memory - Java I read this in
Possible Duplicate: count vs length vs size in a collection In Java in particular,
Possible Duplicate: java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android the following error occur
Possible Duplicate: Can someone explain this template code that gives me the size of
Possible Duplicate: C++ Error: free(): invalid next size (fast): That's a C++ question (albeit
Possible Duplicate: What is the Maximum Size that an Array can hold? i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.