SHARE
TWEET

Untitled

a guest Jul 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## interface Comparable and Comparator ##
  2. -----------
  3. ### interface Comparable ###
  4.  
  5.   Comparable : This interface has one method compareTo. Class whose objects to be sorted must implement this
  6.   Comparable interface. In this case there is one form or way of sorting, e.g. We can sort players by age, so
  7.   if we want to sort them by ranking or by name, in this case we have to change our Player class and change compareTo
  8.   method to do that.
  9. -----------
  10. ### interface Comparator ###
  11.  
  12.   Comparator: This interface has two methods equals and compare. Class whose objects to be sorted do not need to
  13.   implement this Comparator interface. Some third class can implement this interface to sort. In this case there are
  14.   multiple forms of sorting, we can write different sorting based on different attributes of objects to be sorted, e.g.
  15.   We can sort players by age, by ranking, and by namewithout change our Player class, to do that we use other class for
  16.   Age Comparison and other class for Ranking Comparison and other class for Name Comparison.
  17. -----------
  18.  
  19. ### The maximum size of array to allocate ###
  20.    Some VMs reserve some header words in an array.
  21.    Attempts to allocate larger arrays may result in
  22. OutOfMemoryError: Requested array size exceeds VM limit
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top