Collection List object performance


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Collection List object performance

  1. #1
    Join Date
    Jan 2007
    Posts
    2

    Collection List object performance

    I have a situation in Java Collection and i am not able to figure a good solution. I am scared about the performance and memory that wil be used

    I have 5 List objects with thousands and thousands of records in it. The List is populated by a database query using jdbcTemplate which return like 200,000 records

    Each record is identified by POLICY_ID. They may be List with multiple records for a POLICY_ID

    I want to extract each POLICY_ID from all the 5 List and make a single List object for each POLICY_ID and for each List and pass it to a print job which will print the data for a POLICY_ID

    Example
    Let say we have POLICY_ID = 15432

    List1 has one record for 15432
    List2 has one record for 15432
    List3 has one record for 15432
    List4 has three record for 15432
    List5 has three record for 15432

    From the 200,000 records in List1 i want to generate a seperate list with 1 record for policy id 15432 and let name is Listperpolicy
    after this logic we have
    Listperpolicy1
    Listperpolicy2
    Listperpolicy3
    Listperpolicy4
    Listperpolicy5

    Can you please guide me on the approach i should take to write a better code

    call print job ( Listperpolicy1, Listperpolicy2, Listperpolicy3, Listperpolicy4, Listperpolicy5)

    Please let me know

    Thanks a Lottttttttt

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    255
    Quote Originally Posted by piusfernandez
    I have 5 List objects with thousands and thousands of records in it. The List is populated by a database query using jdbcTemplate which return like 200,000 records
    Maybe you are taking the wrong approach at the beginning. A good design would eliminate the need to fetch all those records.
    Happiness is good health and a bad memory.

  3. #3
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Why do you need to create a series of lists if you are getting these records from a database? Shouldn't you have your query populate a Table?

    As aniseed suggested, perhaps you should be looking at your problem from another angle. How about creating a class of PolicyHolder, identified with a PolicyHolder_ID of some sort, holding an array or vector of [Policy_ID records]. Search for policy holder, extract the policy/policies. of course, this is dependent upon your needs and your skill at generating queries from your database ...

Similar Threads

  1. Replies: 0
    Last Post: 07-21-2006, 02:23 PM
  2. Collection Classes
    By Ramses@devx in forum .NET
    Replies: 3
    Last Post: 10-28-2002, 09:32 AM
  3. Replies: 1
    Last Post: 05-28-2002, 12:15 AM
  4. Validating XML
    By Jaco de Villiers in forum XML
    Replies: 1
    Last Post: 06-01-2001, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center