aspose file tools
The moose likes Beginning Java and the fly likes HashMap and ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "HashMap and ArrayList" Watch "HashMap and ArrayList" New topic
Author

HashMap and ArrayList

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 973
Hi,

In an interview...i had a question...where i was asked...


In a web application ..among these 2 data structures...which would you use...

I would like to have a more precise answer...

Regards
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9948
    
    6

i would say it depends on the situation. i don't believe there is EVER a single, always correct answer. press for more info on how they are going to use this data structure... what kind of info goes in it, how will it be accessed (and how often), are duplicates allowed, etc.

without that info, you can't answer the question.


Never ascribe to malice that which can be adequately explained by stupidity.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by fred rosenberger:
...press for more info on how they are going to use this data structure... what kind of info goes in it, how will it be accessed (and how often), are duplicates allowed, etc.

without that info, you can't answer the question.

Indeed, I suspect that's what they might really be looking for with such a vague question.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56191
    
  13

Would you use a hammer or a band saw?

Depends upon the job, doesn't it?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12921
    
    3

The question itself is nonsense; it is like asking: "When you need to drive from Amsterdam to Paris, what would you choose: a red car or a blue car?".

HashMap and ArrayList are two different data structures. Which of them you need, depends on what the application needs to do - it doesn't matter if it is a web application or any other kind of application.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 973
Thank you all,

It is definitely as you have all have said...i should have asked for more info ...to clarify the requirements and then decide..


Regards
Ramasubbhu Allur Kuppusamy
Ranch Hand

Joined: Sep 16, 2005
Posts: 120
Originally posted by Marc Weber:

Indeed, I suspect that's what they might really be looking for with such a vague question.


Interesting thought.


Regards,<br />Ram.<br />SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashMap and ArrayList
 
Similar Threads
No comments on this???
Saloon members and points
Average age for entry-level java architects
HFS - JDBC & OCA Preparation?
Fedora 11, Netbeans 6.5 Tomcat 5 or 5.5?, why won;t you play together?