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 89645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:44:56+00:00 2026-05-10T22:44:56+00:00

I am reading log files but not all lines want to be processed straight

  • 0

I am reading log files but not all lines want to be processed straight away. I am using a queue / buffer to store the lines while they wait to be processed.

This queue is regularly scanned for particular lines – when they are found, they are removed from the queue (they can be anywhere in it). When there isn’t a particular line to be found, lines are taken out of the start of the queue one by one to be processed.

Therefore, the queue needs the following:

  • Able to be resized (or give that impression)
  • Have elements removed from anywhere
  • Have elements added (will always be at the end of the queue)
  • Be scanned quickly
  • Depending on performance, have a pointer of where it got to on the last scan.

I initially wrote the code when I had little experience of Java or the API, and just used an ArrayList because I knew it would work (not necessarily because it was the best option).

Its performance is now becoming poor with more and more logs needing to be processed – so, what collection would you recommend to be used in this situation? There’s always the possibility of writing my own too.

Thanks

  • 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. 2026-05-10T22:44:57+00:00Added an answer on May 10, 2026 at 10:44 pm

    LinkedHashSet might be of interest. It is effectively a HashSet but it also maintains a LinkedList to allow a predictable iteration order – and therefore can also be used as a FIFO queue, with the nice added benefit that it can’t contain duplicate entries.

    Because it is a HashSet too, searches (as opposed to scans) can be O(1) if they can match on equals()

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

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer 'Is llblgen just like codesmith?' : In many ways, yes.… May 11, 2026 at 8:55 am
  • added an answer No, I don't think its possible to do with without… May 11, 2026 at 8:55 am
  • added an answer When you are looking for your custom gadget in the… May 11, 2026 at 8:55 am

Related Questions

I am reading log files but not all lines want to be processed straight
I am reading a binary log file produced by a piece of equipment. I
I am reading a binary file into a parsing program. I will need to
I am reading in CSV file and translating it to an SQL Table. The
I am reading a .NET book, and in one of the code examples there
I am reading about COFF file formats, which is commonly used to create an
I am reading image files in Java using java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); On some
I am reading an XML file into a DataSet and need to get the
I am reading WIX script written by others. There are some code really confuses
I am reading over the K&R book, and am a little stuck. What is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.