• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

collection and hashode

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m very confussed what should i study for collection
i have read map list set from api
but i m not satisfied
bcoz i m not able to understand it
i get a picture but not clear
sometimes it seems collection interface is very vast
and what is hashcode
from where should i study hash code

please help me
give me good links for this topic
that makes these topic easy

thank u
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as far as i can see this is definitely one of the easier areas in the exam to gain marks.
Basically just know each of the interfaces and classes in the collection interface -- and maps.
Also- know what makes each one different to the others.

A lot of the exam questions put forward a scenario and ask you to choose the applicable interface for that scenario.

For hashing -- just be aware that if 2 objects are considered equal then they will have the same hash code however if 2 objects have the same hash code then they are not necessarily equal.

Obviously there's more to know but a 15 min crash course on collections should be enough to see u through a lot of exam questions.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hash Codes

List
Set
Map
Collections
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Corey,

I just read ur article on Hashcode. Its really a very good article. I just have a question on this

In the example-3 of ur article( Rule1 satisfied but Rule2 not satisfied)
, How did u say by ur example tht for equal objects the code returned different hashcodes??

Can u just brief me on this??

I think that for 2equal objects according to ur example it will return the same hashcode since the equals method in your example compares the contents and not the address.
In the method definition of ur hashcode you are just returning the difference of the values and this difference has to be same for 2 equal objects since the comparision is made by checking the contents.

Plz do comment on this.
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
U can study Khalid Mugal and K&B.Good stuff is dr.
 
reply
    Bookmark Topic Watch Topic
  • New Topic