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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:09:00+00:00 2026-06-09T18:09:00+00:00

Suppose an external collection has the following two methods: add(BusiessObject) to the end and

  • 0

Suppose an external collection has the following two methods: add(BusiessObject) to the end and remove(BusinessObject). Now, I know the order of objects I want and I want to make sure that the external collection maintains that order. So, if I start with BO1, BO2, BO3, then if I remove BO2 and add it again, I want to make sure that the order will be the same.

I was thinking of keeping my list of present items, in order I want, and upon every insertion, I would clear the external list, and then add all elements from my sorted list. Any other ideas?

  • 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-09T18:09:01+00:00Added an answer on June 9, 2026 at 6:09 pm

    If you don’t have control over the external collection, I think that the solution that you proposed is the way. To keep your Java side collection ordered, you don’t need to keep calling the sort method, but just use a ordered collection like TreeSet or TreeMap, or any collection that implements SortedSet or SortedMap, to store your data. You still need to implement Comparable or Comparator as @AdelBoutros said.

    By the way, I’m curious about your external collection. May you say what is it? Maybe we can think in another approach if we know what it is.

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

Sidebar

Related Questions

Suppose that I have the following record: type t = {a:int} In order to
Suppose I created index with descending order CREATE INDEX `MyTable.MyIndex` USING BTREE ON `MyTable`
Suppose I have two tables, - emp(empId number(1),empName varchar2(50)) and - manager(manId number(5),managerName varchar2(100))
Suppose I have two files containing styles, a.css and b.css. I import them into
I know everything non-dynamic is suppose to be localized but the images we use
Suppose I got an external library bst that handles custom data types insertion in
Suppose I have a relatively long module, but need an external module or method
Suppose we have a user library project ProjectUserlib that uses an external jar external.jar,
Suppose I have this: class external { JFrame myFrame; ... class internal implements ActionListener
Suppose you are working in a javascript project with several external library dependencies, and

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.