Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Usage of Collection classes sorting mechanism in a project

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am having a query againist the usage of a Comparator or Comparable or Collection classes sort Mechanism in util package .

Can any body please tell me where actually this concept will be used in a project.
(What i think is that as the data from database will be returned by applying order by know )

Thank you .
 
salvin francis
Bartender
Posts: 1305
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
great example:
http://www.javadeveloper.co.in/java-example/java-comparator-example.html

if your data is coming from a database, i would prefer to do the sorting in the query itself rather than code unless
it involves user sorting a subset of data shown in UI, at that point i would use it in code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic