We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

which collection to use...

Jagadeesh M
Jagadeesh M asked
on
Medium Priority
275 Views
Last Modified: 2010-08-05
I 've a resultset table from database as follows -

COUNT -- SSN --  ID -- LASTNAME -- FIRSTNAME --  APPLYTERM -- ENTERING_STATUS --  PART_FULL_STATUS -- PROGRAMCODE -- EMAIL --  HOME_PHONE -- STATUS
7---111111111---223---yang---yiping---2005S---F---F---NKCCSCS  BS---yy32@njit.edu---<NULL>---c---
7---111111111---193---wong---siu---2006S---F---F---<NULL>---wong@njit.edu---<NULL>---c---
7---111111111---370---kumar---Jagadeesh---2006S---F---F---NKARCARCHBAR---jm337@njit.edu---<NULL>---p---
7---111111111---159---xi---zhouzhou---2005S---R---F---NKSLASTS BS---yy32@njit.edu---<NULL>---p---
2---123111111---359---Motamarri---jagadeesh---2006S---F---F---NKCCSCS  BS---jm337@njit.edu---<NULL>---c---
4---123121234---369---Motamarri---Jagadeesh---2006S---F---F---NKSLAEVSCBS---jm337@njit.edu---<NULL>---p---
2---137156075---299---nash---john---2006S---T---F---NKNCEMNETBET---yy32@njit.edu---<NULL>---c---


I need to put them in a collection say ....hashmap or treemap or whatever that does not change this order of rows...

and retrieve them in the same way....

can an y body help me with the code... java && jsp


i mean i need to put and retrieve in jsp

thank you.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
You can make a List of List or save a List of 'Person' beans

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Jagadeesh MBig Data and Splunk Architect

Author

Commented:
I like the idea of vector into a list....and retrive it


and can anyone provide me sample code...for the same
Commented:
LinkedList will the collection that will not change the Order.
In case of Maps, LinkedHashMap will preserve the Order in which the data is enterred.
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)

You need a *nested* collection
Jagadeesh MBig Data and Splunk Architect

Author

Commented:
Yea i was able to figure it out.

I used Vector of ArrayList.


Thankz though
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>I used Vector of ArrayList.

ArrayList of ArrayList would probably be better
Jagadeesh MBig Data and Splunk Architect

Author

Commented:
Actually the module thatz existing is written using TreeMap and Vectors....since the TreeMap is a sorted one, the results are not the one that i'm putting into vector....so i need something  to hold the values as they are inserted...so i felt arraylist of vector to be one option.

using arraylist i was able to wrap up just by changing few lines of code....

thankz
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.