Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
    Bookmark Topic Watch Topic
  • New Topic

How Comparator and Comparable Help in Searching from a Collection  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm trying to find the best way to search an object with a specific field from collection. So according to my knowledge, comparator and comparable interface can help in SORTING but how they can help in SEARCHING and item from arraylist or Map with respect to object property.....?


Please help me clearing this doubt...

Thanks
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!