Results 1 to 2 of 2
  1. #1
    blueduiker is offline Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    55
    Rep Power
    0

    Talking what is natural ordering???

    I was up the sort method of the array class for my school project and it says that the sort class orders the objects in the natural ordering. What does this mean?


    static void sort(Object[] a)
    Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,727
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by blueduiker View Post
    I was up the sort method of the array class for my school project and it says that the sort class orders the objects in the natural ordering. What does this mean?


    static void sort(Object[] a)
    Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.
    The natural ordering of two objects a and b is the outcome of a.compareTo(b), i.e. what those objects themselves think which one is smaller, greater or equal to the other object. Normally a.compareTo(a) == 0 and if a.compareTo(b) <> 0 then b.compareTo(a) >< 0. The entire thing melts away when you think of integer numbers, e.g. 3 < 4, so 4 > 3 and 3 == 3

    kind regards,

    Jos

Similar Threads

  1. getting all possible ordering of vector
    By sara12345 in forum New To Java
    Replies: 3
    Last Post: 01-08-2010, 11:21 PM
  2. Problem with ordering for loops
    By ScaryJello in forum New To Java
    Replies: 3
    Last Post: 03-31-2009, 09:20 PM
  3. Natural CLI 1.2.2 released (bug fix)
    By ferranb in forum Java Software
    Replies: 0
    Last Post: 07-20-2008, 12:37 AM
  4. Natural CLI announcement
    By ferranb in forum Java Software
    Replies: 0
    Last Post: 06-14-2008, 12:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •