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

  • SEARCH
  • Home
  • 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 7890331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:19:37+00:00 2026-06-03T06:19:37+00:00

I have the need to take an ArrayList<Conference> conferences , where Conference contains a

  • 0

I have the need to take an ArrayList<Conference> conferences, where Conference contains a public Date beginDate parameter, and sort as follows: first, separate conferences into buckets which represent unique months for beginDate, and then sort on beginDate itself within the buckets. I’m sure this is a common need so I was hoping someone here would have some tips.

My idea for this follows. Please tell me why it is sub-optimal 🙂

  1. Create a HashMap<Date, ArrayList<Conference>>.
  2. Iterate over conferences and use a special static function to find the first day of the month of their beginDate, check if there is an ArrayList<Conference> for that Date. then add them to the ArrayList for that Date (which should all be the same because first_day_of_month(any_day_in_month) is the same.
  3. Iterate over each ArrayList member of the HashMap and use a standard sorting procedure to sort the ArrayList by date.

This seems more complicated than necessary, but please let me know why it’s bad and what can be done to fix it.

Edit: Also, if it matters, I will eventually need to add all of those ArrayList back into an ArrayAdapter which will go in commonsware’s MergeAdapter… 🙁

  • 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-03T06:19:39+00:00Added an answer on June 3, 2026 at 6:19 am

    If you sort by the date from the very beginning the month’s entries will be subsequent either way. After the initial sorting you can iterate over all entries and make artificial “split” if an entry is the first one of new month. I am not even sure you will need to do such differentiation (maybe becasue the question is a bit vague on this).

    The total complexity of the proposed algorithm is O(nlog n), where n is the number of elements, and of course there is no better solution.

    NOTE Btw this algorithm is better than the one proposed by you in operations complexity.

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

Sidebar

Related Questions

This is my first post here. I have a problem. I need to take
i have an ArrayList with elements for example: [a,b,c,d,e,f,g,h]; and need to take elements
I have a phonegap application which will need to take a zip archive of
I have a homework assignment where I need to take input from a file
I need to take a url, /ServiceSearch/r.php?n=blahblah, and have it go to /search/blahblah/ so
I have an int[] array. I need to take an int and append it
I have a task to do, I need to take data that has been
I have a user control with several buttons, which need to take different actions
I have a task I need to perform, do_stuff(opts) , that will take ~1s
I often have a need to take a list of objects and group them

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.