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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:50:46+00:00 2026-05-29T03:50:46+00:00

I am making an application where users will be typing on a shared document

  • 0

I am making an application where users will be typing on a shared document over a network.
One of the issues is blocking lines that other users are typing in.
To do that I have a DocumentListener that is checking for line changes. When a user successfully moves to a new line (which means that line is not used) the listener will notify other users that the line is now used.

A DocumentFilter will check each time an edit is made if that line is blocked, before allowing it.

Now, one of my concerns is what kind of collection is most appropriate for storing the line numbers. The collection will be holding just Integer. When a line is blocked it will be added to that collection. When the DocumentFilter needs to check if a line is available it will go through that list . Also when the user that was using that line moves to a new line, another message is send that will remove that line from the collection of users.

I am aware that an ArrayList will probably be enough although I was hoping someone might think different.

  • 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-05-29T03:50:46+00:00Added an answer on May 29, 2026 at 3:50 am

    HashSet<Integer> will outperform an ArrayList<Integer> by a large margin if you expect a large amount of Lookups and a large amount of blocked documents.

    As far as i know worst case lookups(referring to “contains”) are

    • O(n) – ArrayList
    • O(log2(n)) – SortedList
    • O(1) – HashSet however this is related to the hash method ..

    If you need to track additional data on a per lock basis you might consider to use a HashMap<Integer, ILockInformation>.

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

Sidebar

Related Questions

I am making an application that will allow users to apply certain tools to
I am making an application that does some custom image processing. The program will
I am developing a rails application that will eventually contain products, users, and orders.
I currently have an application that gets hit with over 20,000 users daily and
I am making a application that uses the GPS receiver. The application will work
I am making an application that will work much like a real time chat.
I'm building a Page Tab application that will allow Facebook users to make purchases
I am running a Facebook application that asks users questions. When they complete one
I'm making a small tool application that user can minimize in the taskbar .
I'm making a php web application which stores user specific information that is not

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.