Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Help me to solve my problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help me to solve my problem" Watch "Help me to solve my problem" New topic

Help me to solve my problem

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200

I am learning Collections in Java. I want the example and explanationfor all the collections such as
Set - LinkedHashSet, HashSet (SortedSet - Treeset)
List - ArrayList, LinkedList and Vector
Map - HashMap, LinkedHashMap, HashTable (SortedMap - TreeMap)

Please provide me with some good tutorial for beginners to learn collections other than the Sun's tutorial.

ArrayList, Vector, LinkedList: I Know these concepts and have a general idea about what it is.

But I always struck with Hash table concepts. Also If you know any tutorial for beginners to easily understand the concepts of hash table will be helpful.
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Head First Java, by Bert Bates and Kathy Sierra
Thinking in Java (Free online), by Bruce Eckel
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
marc weber

Joined: Aug 31, 2004
Posts: 11343

Chapter 11: "Collections of Objects" from Bruce Eckel's Thinking in Java...

"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
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
To understand hash tables you must understand the purpose and nature of hash functions. It's all about reducing a string to a single numeric value. If you then use that value to identify a storage location, you can lookup an element without a search: compute the hash value, that's your location.

It's slightly more complicated than that. Duplicate values are frequently generated and hash functions are not limited to strings by any means. But, generally speaking that's all you need to know.
marc weber

Joined: Aug 31, 2004
Posts: 11343

Here's my analogy for lookups using hashCode...

Imagine a library with numerous rows of bookshelves. If you're looking for a particular book, it would be a lot faster if you knew what particular row of shelves to look in, rather than searching through the entire library. Of course, when you've found the correct shelves (indicated by hashCode), there might be other books on those shelves (because different objects might return the same hashCode), but you've narrowed your search to a much smaller region.
I agree. Here's the link:
subject: Help me to solve my problem
It's not a secret anymore!