Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How can I sort the Salary of the emps?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


 
Saloon Keeper
Posts: 7173
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can, but not if you pass in a null SortMethod. If you don't have a SortMethod, omit the parameter, and it will sort the elements in their natural order. See https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html for the javadocs of both methods.
 
Marshal
Posts: 74371
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your indentation in the first class is good, but please don't put empty lines inside methods. Put empty lines between methods instead. The indentation in the second class is poor, and the nested enum is really difficult to read; the length of line 56 makes that worse.
Be sure not to start package names, parameter names, variable names, or method names with CapitalLetters. Only classes and interfaces should start with CapitalLetters.
Only use _ in names if they are CONSTANT_NAMES or package names that won't compile without the _. See the Java™ Tutorials.
 
reply
    Bookmark Topic Watch Topic
  • New Topic