Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Which is efficient Arraylist or Hashmap??

  1. #1
    Member Ganeprog's Avatar
    Join Date
    Jan 2014
    Location
    Chennai,India
    Posts
    80
    My Mood
    Love
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Lightbulb Which is efficient Arraylist or Hashmap??

    Hi,

    Actually, my project flow is

    html,css,js<--->ajax<-->jsp<--->jdbc(.java)<--->mysql.

    In that jdbc i am returning the records from the database and fill into the resultset. From the resultset i put all records in arraylist and passed to jsp then i am displaying data in the screen.

    I need a suggestion which one is efficient to use. Whether i can use arraylist, hashmap or treetable?????


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Which is efficient Arraylist or Hashmap??

    Before determining which is most efficient, I'm not sure the choices you've listed are equally appropriate for what you're trying to do. Further, if what you're doing is working, why change? Are you experiencing an issue that requires you to seek a more efficient approach? If so, what's the issue you're trying to solve?

  3. #3
    Member
    Join Date
    Sep 2013
    Posts
    68
    My Mood
    Confused
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default Re: Which is efficient Arraylist or Hashmap??

    In your case its better if you make a POJO( Plain old java object), while retrieving the data in the result set instantiate the pojo and pass that pojo object to jsp.

  4. #4
    Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    62
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Which is efficient Arraylist or Hashmap??

    I feel ArrayList would be a better way to implement the stuff you are trying.
    Thanks and regards,
    Sambit Swain

Similar Threads

  1. How to solve OutOfMemoryException using arraylist & hashmap
    By Karpahasundaram in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 12th, 2013, 05:03 AM
  2. can anyone think of a more efficient way of doing this...
    By mia_tech in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 19th, 2012, 10:32 AM
  3. Adding key/value pairs from a HashMap in to an ArrayList
    By vb89 in forum Collections and Generics
    Replies: 0
    Last Post: February 26th, 2012, 10:36 PM
  4. private Map<String, ArrayList> xlist = new HashMap<String, ArrayList>();
    By Scotty in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 21st, 2011, 08:37 AM
  5. hashmap & arraylist mapping
    By abhi178 in forum Collections and Generics
    Replies: 3
    Last Post: November 29th, 2010, 07:32 AM

Tags for this Thread