[q] how to understand the 'order' of a list?

hi,everyone
there's a test program:
import java.util.*;
public class testList
void test()
LinkedList ll= new LinkedList();
ll.add("3");
ll.add("1");
ll.add("2");
ll.add("5");
ListIterator li = ll.listIterator();
while (li.hasNext())
System.out.println(li.next());
public static void main(String[] args)
testList tl = new testList();
tl.test();
As we know, order is the most important feature of a List.
But this program's result is " 3 1 2 5 " which is not a sorted list!
How we understand the phrase 'order' ?
And , is there any method in Collection which can sort the elements in one collection (list or set)?
thanx a lot!

As we know, order is the most important feature of a
List. Yes, and it preserves the order you have used to put elements in the List. :)
But this program's result is " 3 1 2 5 " which is not
a sorted list!Well, what order to you actually like? "1 2 3 5"? Why not "5 3 2 1"? And for more complicated objects "natural" order may be even less obvious. And never forget that List may contain objects that belong to different classes - for example Integer, String and Date - how they are to be ordered? (Of course, such usage is not recommended).
How we understand the phrase 'order' ?
And , is there any method in Collection which can
sort the elements in one collection (list or set)?There are sort-methods in java.util.Collections class.

Similar Messages

  • How to reverse the order of a list (nodes)

    i can't figure out how to reverse the order of the values in a list of nodes. Could anyone help?
    public class IntList
         public IntNode head;
         public IntList()
              head = null;
         public void reverse()
              // I don't know how to write this
    }

    read through the list from the end to the start, putting each element into a new list. then replace the original list with the new one.
    lots of ways it can be done.
    dont ask me which is more efficient. the stack suggestion sounds pretty good.

  • How to change the order of albums iOS 8?

    I recently upgraded from an iPhone 5 to a 6 Plus. Everything is fine except for the fact that some of my music is in the wrong order. There are some groups that released multiple albums in the same year, and I would like them to be in the order of when they were released. On my 5 I was able to put them in the right order by going on a computer, changing the sorting, then update iTunes Match to have it change on my phone as well. (example; group came out with album "1" and "2" same year and it defaults to "2" first, then "1." I was able to change it on the iPhone 5 to be in the right order by changing how they are sorted from my computer but that doesn't work on the 6 Plus.) I would like to order it where it goes top to bottom, with the newest on top going down. How would I do this?
    Thanks

    Hi Jason,
    How to change the order of tables within sheets
    Make a table active by clicking in it once to select that table, then drag it by the 'bullseye' (top left, I have placed a red circle to show the bullseye):
    After dragging the table down:
    Table 1 is now below Table 2.
    The blue line is an Alignment Guide
    Two types of Guide:
    1. Menu > View >Show Rulers. Drag Alignment Guides from a ruler to where you want them.
    2. Menu > Numbers > Preferences > Rulers > Alignment Guides. Turn on (tick) both guides. That allows you to align objects with *each other* (as well as with the ruler guides). These guides help to align objects left, middle, right, top, bottom.
    Alignment Guides do not show unless you are moving an object.
    to drag/move table to another sheet in the one file
    Not possible in Numbers 3. The Sheets Pane has gone. Instead, select the entire table (click once in the table to make it active, then click on the bullseye). Copy (or Cut if you are brave). Go to another Sheet and Paste.
    Also can you change the size of sheet tab width on tab toolbar, so I can see more sheets at once??
    No. Let's hope this will be added in future updates. However, you can drag a Sheet tab left or right to reorder them.
    Another tip: each Sheet tab shows the contents of that Sheet, with some options such as Duplicate and Delete:
    Regards,
    Ian.

  • How to get the order for these decoration​s?

    hello,
    I want to programatically resize all the controls, indicators and decorations on the front panel.
    I am getting the references of all the controls and indicators and able to resize them, as each n every control and indicator has a tabbing order set to it.
    I am also getting the references of all the decoration used on the front panel but not able to get the order.
    how to get the order for these decorations?

    The order of the decorations is the same as the back to front order. So you
    can change it by bringing decorations to front, or sending them to the back.
    It has been suggested many times that decorations should have labels as well
    as controls, but at the moment there is no way to tell which reference
    belongs to which decoration (besides position and order).
    Regards,
    Wiebe.

  • How to understand the STAD relevant for RFC

    Hello performance experts.
    I have question about how to understand the STAD relevant for RFC.
    I want to know how to calculate the response time of action of "Push save buttion"
    which call function module by RFC.
    In our system, the screen is created using web dynpro and after push the button,
    function module for application will be called.
    When I push Save button, 2 STAD line is created.
    One is for function code " SAVE" and the other is for "RFC".
    Line for "SAVE" include RFC as client, and RFC line has RFC info as server (also client)
    I wonder how I should calculate the response time of action"Save" button in following case.
    Should I add the 2 response time?
    1) 5,867 ms +   5,797 m  is collect?
    2) 5,867 ms  include RFC time, so no need to sum the value and 5,867 ms is collect??
    3)  590 ms  +   5,797 ms is collect?
    4) Or other calculation is correct ?                                                   
    1) STAD for function code:    
    CPU time                     578 ms    
    RFC+CPIC time              5,280 ms                                                  
    Total time in workprocs      594 ms
    Response time            5,867 ms                                                                 
    Processing time              590 ms    
    Load time                      1 ms               
    Wait            5,273  ms
    Roll (in+wait) time        5,274 ms
    as Client
    Number    Connections                              1
               Destinations                             1
               Users                                    1
               Calls                                    2
    Time      Calling                              5,280   ms
               Remote execution                    10,527   ms
               Idle                                11,110   ms
    Data      Sent                               135,836   Bytes
               Received                               620   Bytes
    2) STAD for RFC
    CPU time                   1,406 ms
    RFC+CPIC time                  9 ms
    Total time in workprocs    5,080 ms
    Response time            5,797 ms
    Processing time            2,132 ms
    Load time                     50 ms
    Roll (in+wait) time          718 ms
    Database request time      2,882 ms
    Enqueue time                  16 ms
    Roll time
    Wait              717  ms
    as Client
    Number    Connections                              1
                      Destinations                             1
                         Users                                    1
                           Calls                                    4
    Time      Calling                                  9   ms
              Remote execution                         1   ms
              Idle                                     0   ms
    Data      Sent                                   686   Bytes
                 Received                             1,360   Bytes
    as Server
    Number    Connections                              1
              Destinations                             1
              Users                                    1
              Calls                                    2
    Time      Calling                              5,272   ms
              Remote execution                     5,269   ms
              Idle                                        11,118   ms
    Data      Sent                                   620   Bytes
              Received                           135,760   Bytes
    Thanks for your cooperation in advance.
    Keiichiro

    Hi Keiichiro,
    I wonder how I should calculate the response time of action"Save" button in following case.
    Should I add the 2 response time?
    1) 5,867 ms +   5,797 m  is collect?
    2) 5,867 ms  include RFC time, so no need to sum the value and 5,867 ms is collect??
    3)  590 ms  +   5,797 ms is collect?
    4) Or other calculation is correct ?
    It depends of what you mean with response time of action "Save" button.
    If you mean ALL time, the value is 5.867 because the local time from save was 594ms, the "external" RFC time was 5280ms.
    If you want separete analysis, the 594ms is your option since the 5280ms is in other part...
    Also, analysing the other part there's another other part which represents a good part of processing time:
    Database request time      2,882 ms
    Hope this help youl.
    Regards, Fernando Da Ró

  • How to organize the orders of audio files in ipod?

    Hey guys, I'm having a problem in organizing the audio files on my ipod, I wish you could help me out. I transferred some language lessons to my ipod, however they are not in order. If they are just songs it's OK, but for language lessons you really want them to be in order. Anybody can teach me how to arrange the order of audio files on ipod? Thanks a lot!
    ipod video 30GB

    Thanks for the reply, Chris. Are you talking about how to change the file name on itune or on ipod? I couldn't find the way to edit any info of the audio files on itune. And the file names were already in order (i.e. French001,French002...) but they appear on itune & ipod in different order.
    Thanks again.

  • How to change the order of the icons in the dock with Lion?

    Hello
    since I've installed Lion on my Mac I cannot change the order of the icons used for quick launch.
    Any idea how I customize the order of the icons?
    Thanks
    Mac-Fanatic

    I suspect you'd get a very prompt reply in the Lion forum:
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion

  • How to change the order of users in appearance of login screen?

    Hello!
    Because we often switch to a user,
    which is listed last in login screen,
    we want move them to the second place.
    How to change the order of users in appearance of login screen?
    Thank you for a tip
    Erhy

    The order users show up on the login screen is the way they are ordered under the
    C:/Users directory. This is usually alphabetical, AFAIK there is no other way to change the order other than to change the username to something that starts with a letter that will be higher alphabetically.

  • How to change the order of the fields in the queryoutputnode in OVS.

    How to change the order of the fields in the queryoutputnode in OVS.

    The actual requirment is to re-arrange the elements of the queryoutput node, to look more organised
    say for ex.
    Seq 1:
    c code                            company name                          g/l ac                g/l ac description  
    Seq2 :
    g/l ac description             c code                                       g/l ac                company name  
    Seq 1 way of representation is more organised that Seq2. How can we achieve this re-arranging of ordering in the queryoutputnode.

  • How to understand the hierarchy structure of 0PLANT io?

    how to understand the hierarchy structure of 0PLANT io ?
    i can understand the hierarchy structure of PRODUCT io,
    well, i hope someone could explain the hierarchy structure of 0PLANT io
    thanks.

    Hi
    You can use following hierarchy tables
    RSTHIERNODE - Texts of Non-Postable Hierarchy Nodes
    RSEHIERNODE - Master Data: Hierarchy Nodes that Cannot Be Posted To
    RSMHIERNODE - Master data: Hierarchy nodes that cannot be posted to
    RSHIEDIR - Hierarchy Catalog
    RSHIEDIRT - Hierarchy directory texts
    RSREQHIER - Data Request hierarchy
    RSROLEHIERARCHY - Role hierarchy
    In addition to these have a look at K table & I table for 0PLANT.
    K table - Hierarchy SID table
    I table - Hierarchy structure table
    Hope this will help..!!
    Thanks,
    Vikrant

  • Can't remember how to reverse the order of the tracks in a playlist ~ can anyone help  me out?  Thanks.

    Can't remember how to reverse the order of tracks in a playlist.....can anyone help me out?  Thanks.

    Were you able to figure it out?

  • How to find Sales order numbers for List of Deliveries

    Hi
    How to find Sales order numbers for List of Deliveries
    Thanks
    Muthu

    Hi,
    Open the delivery list.
    Select  a delivery, goto menubar, environmment, document flow.
    Here u can able to see the  order no. (but, here u can see one by one , not cumulatively)
    Regards
    Kaleeswaran

  • Please check the order's object list (inconsistency SOBJ)

    Hi Friends;
    I am facing a strange issue where I have copied a custom task from SAP standard decision task 00008267 caz I needed to perform some custom requirement on it.
    I have done evry thing but then I have observed that Agent assignment is not coming at testing client which is on same server.
    I also can not modify any thing at testing client.
    So I performed SCC1 from testing client and check but still same issue.
    Then I thought of re assigning agent at development client but while making it general task it pop up the message "Please check the order's object list (inconsistency SOBJ)".
    And after again performing the SCC1 still the issue exist.
    Can any one suggest their inputs where the problem could be and how should I fix it.
    Regards
    Devraj

    Hi Dev,
    Can you please share more details? Agent assignment not coming means?
    Have you set the task as General in testing client?
    Thanks,
    Viji.

  • How to display the count of a list item in Sharepoint Designer?

    How to display the count of a list item in Sharepoint Designer? please reply with the proper code line to add for this.

    Hello,
    What version of sharepoint you are using? Try below approach:
    http://sharepointlogics.com/2010/03/total-count-of-items-in-list-in.html
    Hope it could help
    Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer
    Please feel free to unmark answer if does not resolves your problem.

  • How to capture the multiple value in list box

    Hi forums,
           How to select the multiple values in list box and how to catch that values in OnInputProcessing.
    Regards,
    Ravi.

    Hi,
    A possible method is:
    Get all fields of the form
        CALL METHOD request->get_form_fields
          CHANGING
            fields = table_fields.
    loop over the fields
        LOOP AT table_fields INTO wa_fields.
    test the name of the field
          CASE wa_fields-name.
            WHEN 'test'.
    retrieve the value of the field
              test = wa_fields-value.
    endcase
    endloop.
    Eddy

Maybe you are looking for

  • Updateable Report : re-display collection & Update Button question

    This a sequel to a previous Updateable Report question I had. Varad pointed me to this doc which has been incredibly helpful . http://www.oracle.com/technology/products/database/application_express/ howtos/tabular_form.html#RESTRICTIONS I was\am havi

  • Why isn't bootcamp on Windows 7 64-bit not using graphics card?

    I have a Macbook Pro Retina 15' inch. I partitioned Windows 7 Ultimate through BC and used 60GB for the partition. I successfully downloaded Windows 7 but realized that the wireless and such did not work. So I updated the drivers manually through the

  • How do I remove Ask from my computer?

    did a greeting card for someone and inadvertently installed Ask onto my computer... toolbar and search engine etc. Having trouble following different instructions by using web sites

  • Drives Eject on Sleep

    Hi, When I sleep my iMac, some of the drives eject. When I wake my computer I get the improperly ejected warning dialog. I don't have the "Put Hard Disks to sleep" check enabled. What's going on?

  • SQL Server Express 2014 and SQL Server Agent

    Any chance SQL Server Express 2014 supports SQL Server Agent. I have a home weather database and I have to import Data every 30 seconds.