• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

List performance- design issue

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a requirement:
I have two Lists:
1. Student List (with subject info)
2. Subject List.(with student info)

I need to display the contents as given below:

1. All the students who are studying subject 'maths' -- search by Math
2. all the subjects studied by a student 'Jhon' -- search by Student

how do i achieve it. I need to design a solution. But wondering how to desing it.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd start by implementing the simplest solution - that is, iterating over the lists and picking up the items that meet the criteria. Then measure the performance. If and only if it turns out to be a bottleneck of your application, start thinking about how to improve it.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look at filter() method from Collections2 of google-guava library.
 
Andreas Hollmann
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also if you want to increase the performance of your list you can use SortedList decorator of happy-library.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Vajsar wrote:I'd start by implementing the simplest solution - that is, iterating over the lists and picking up the items that meet the criteria. Then measure the performance. If and only if it turns out to be a bottleneck of your application, start thinking about how to improve it.


I agree, with one caveat...You need to have defined, measurable criteria for what is "fast enough" BEFORE you do the tests. Defining that sort of thing after you've run your tests is pointless.

It seems like all far too often, if these things aren't defined ahead of time, it doesn't matter what the results are, someone will say "That's not fast enough". So, you define the requirements FIRST, and then work to meet them.
reply
    Bookmark Topic Watch Topic
  • New Topic