Order of Elements in Collections.

Hi,
Can anyone let me know which collection types maintain the order of the elements in which the elements are inserted.
Also, as what does it mean if we say that a HashMap doesn't maintain the order of the elements ?
How does the order change after the elements are inserted in the HashMap ?
Thanks in advance.

I thought I would follow up with the solution.
The method I described above does work, but in order to make it work I had to find a way to make all elements in all collections appear in the same order. In order to do that, I needed a unique key for each object in the tree, that would be the same in both the original and the modified tree.
In my case that was easy, b/c I get the original version from Hibernate and I make my modified version by copying it (also by serializing the original into memory and then deserializing it into my new "modified" working copy tree), so they both still contain the hibernate oids.
The extra step I needed to do before serializing and comparing was to recurse through both trees (with Introspection) and replace all sets with a TreeSet and all lists with my own implementation of a sorted list.
Now I can compare any tree of domain objects that extend from BaseDomainObject (they all do) by simply writing
domainObjectTree1.autoEquals(domainObjectTree2, new String[] {"terminatorProperty1", "terminatorProperty2", ...})
Terminator properties are basically properties which I set to null before running my comparison. This allows me to "cut off" branches of the tree that I don't want to be compared.

Similar Messages

  • Reverse the order of elements in an array

    how would i go about Reverse the order of elements in an array??

    I link to the javadocs can't be too bad. [url
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Coll
    >
    ections.html#reverse(java.util.List)]Collections.rever
    se(List)Of course I fortell the next question, but I wantan
    Array not a List? So I provide the next link:[url
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arr
    ys.html#asList(T...)]Arrays.asList(T...)Yeah but then you have to worry about the next
    question which is more of a statement: "I can't use
    Arrays".
    Then I would as them: How would you do it in real life? Of course they could think a real world way of doing it. In that case, I'll give them an real life example.
    Assumed List
    1 2 3 4 5 6 7 8 9 10 11 12 13
    Switch the first and the last elements
    13 2 3 4 5 6 7 8 9 10 11 12 1
    Then the second and second to the last
    13 12 3 4 5 6 7 8 9 10 11 2 1
    And repeat until your half way.
    13 12 10 4 5 6 7 8 9 3 2 1
    13 12 10 9 5 6 7 8 4 3 2 1
    13 12 10 9 8 6 7 5 4 3 2 1
    13 12 10 9 8 7 6 5 4 3 2 1
    Done.

  • Will the order of elements stored in pl.sql table retains

    Hello Friends,
    I am having a record type and the for each element of record , i am having corresponding pl.sql table type .
    If i am storing the values into the records from a query and also the individual elements in the pl.sql table type will the order of data is stored as it is . ..
    example...
    in a record type the data is stored as ( name1 , age1 , salary1) , (name2, age2, salary2)
    if i store in corresponding pl sql table type name1 , name2
    age1, age2
    salary1, salary2
    can i relate the index of record type with that of pl/sql table type ..
    pls advice
    thanks/kumar

    Kumar,
    Yes, the order of elements will be the same.
    Any specific reason why you would want to create a collection for each individual attribute of the record ?
    You can as well declare another variable of the same record and initialize it.
    A few other suggestions for your code :
    1) The 2nd FOR loop can be modified to accommodate the query of the first cursor there-by eliminating one extra iteration.
    SELECT MINC.FAMID,
                         MINC.MEMBNO,
                         MEMB.AGE,
                         SALARYX,
                         SALARYBX,
                         NONFARMX,
                         NONFRMBX,
                         FARMINCX,
                         FRMINCBX,
                         CU_CODE
                    FROM MINC, MEMB, FMLY
                   WHERE MINC.FAMID = MEMB.FAMID
                     AND MINC.MEMBNO = MEMB.MEMBNO
                     AND MINC.FAMID = FMLY.FAMID
                     AND MEMB.FAMID = FMLY.FAMID
                   ORDER BY MINC.FAMID2) The collections can be alternately initialized as follows :
       v_member_rec(v_member_rec.last).FAMID := j.FAMID;
       max_earnings_tab(max_earnings_tab.last) := v_max_earnings;The tried the below example for confirmation ...
    declare
    type emp_rec is record
    (name emp.ename%TYPE,
      dept emp.edept%TYPE,
      sal  emp.esal%TYPE
    TYPE emp_rec_tab is table of emp_rec;
    ert emp_rec_tab := emp_rec_tab();
    TYPE ename_tab is table of varchar2(20);
    ent  ename_tab := ename_tab();
    TYPE edept_tab is table of number;
    edt  edept_tab := edept_tab();
    begin
    for i in (select * from emp)
    loop
         ert.extend;
         ent.extend;
         edt.extend;
         ert(ert.last).name := i.ename;
         ert(ert.last).dept := i.edept;
         ert(ert.last).sal := i.esal;
         ent(ent.last) := i.ename;
         edt(edt.last) := i.edept;
    end loop;
    for i in 1..ert.count
    loop
         dbms_output.put_line(ert(i).name||','||ent(i));
         dbms_output.put_line(ert(i).dept||','||edt(i));
         dbms_output.put_line('');
    end loop;
    end;

  • Travel Expenses settlements against Service Order/WBS Element/Project Ord

    Hi Experts,
    I have one req. in Travel Expenses, i.e. need to settle travel expneses against Service Order/WBS Element/Project Order.
    Can you guide me how to do this req.
    Thanks & Regards
    Rajesh

    Hye mate,
    This is possible for sure what you need to do is to go at travel request . In travel Request there is an option of Enhanced Travel cost/ Alternative master cost center. if you click on it . you would find an option of cost assignmnet click on it
    there you would have option , like an excel sheet like fields of  the cost centre, wbs element, profit center, order number what eve is requred and save it.
    now the cot of trip would go that particulat cost center or der numbe or WBS rather then the cost center assigned at master data in ifototype 0027.
    Regards
    Waqas Anwar

  • How can i change the order of  elements in a JList ?

    Hi,
    i would like to know if it is possible to change the order of elements in a JList ? Maybe i could use drag and drop to do this ?
    Thanks for answering.

    The simplest way is probably to implement ur own listmodel and then supply the listitems in the order u want. Example:
    class MyListModel
              extends AbstractListModel
              implements ContactListListener {
    public int getSize() {
    return listitemcount;
    public Object getElementAt(int index) {
    //here u return the item for the index at the list
    //if u for example have an array of strings
    //which u wanna have listed in reversed order (reversed to
    //the order in the array, u could do
         return myarray[getSize()-index];
    }

  • How to export an album and keep images in the same order in elements 11 mac

    I made an album of my trip to Australia (lots of pictures) and changed the order of the images (not the same as shooting order) and when I export the images in the album to a folder or memorystick, the images are copied to that place but I lost the album order of the images.
    How can I prevent that, without having to renumber al 500 images separatly?
    Gr Jos

    Thanks for the tip, Michel
    It worked like a charm…
    cheers Jos
    Op 28 okt. 2013, om 18:49 heeft MichelBParis <[email protected]> het volgende geschreven:
    Re: How to export an album and keep images in the same order in elements 11 mac
    created by MichelBParis in Photoshop Elements - View the full discussion
    JosU a écrit:
    I made an album of my trip to Australia (lots of pictures) and changed the order of the images (not the same as shooting order) and when I export the images in the album to a folder or memorystick, the images are copied to that place but I lost the album order of the images.
    How can I prevent that, without having to renumber al 500 images separatly?
    Gr Jos
    The order in album is only kept in the organizer database, so the only way not to lose that order is to rename files.
    If you are using the 'export' function, select your album in custom order, select all photos and in the dialog, choose to rename with a common base name.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5794538#5794538
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5794538#5794538
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5794538#5794538. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Different Order Types within a Collective Order

    Dear PP Gurus,
    I have a requirement for having different order types with in a collective order. For example, in a BOM of 3 levels, the order type for each assembly should be different say ZPP1, ZPP2 and ZPP3.
    For this, I have maintained separate production scheduling profiles in each of these assemblies with the respective order types. Also, I have maintained MRP groups separately for each of these materials. Further, in Plant Parameters, no default order type is assigned.
    However, when I create the order, the system creates all orders with order type ZPP1 which is for the header material.
    As per SAP help, this is possible but I am not able to create collective order with different order types.
    Please suggest any SAP Note or configuration changes which I have missed out.
    Thanks!
    With Regards,
    Nitin

    Dear Sabine,
    Thanks for your reply.
    However, as per SAP help, this is possible. Please refer to the link http://help.sap.com/saphelp_470/helpdata/en/ee/b6532cae8011d19e97080009b0db33/content.htm
    In this link, under Pre-reuisites section, in Point 2 it is mentioned
    "This indicator is transferred into the order header (master data) of the orders. If there are differing order types within the collective order, the setting of the indicator of the order type of the leading order takes precedence. This indicator is transferred to all lower-level orders and overrides their original indicators."
    The above line implies that different order types are possible with in a collective order.
    Please suggest some way out.
    Thanks!
    With Regards,
    Nitin

  • Have ordered Photoshop Elements 12 and Premiere Elements 12 (for MAC, EN version). Order went through but finally order was cancelled as Adobe Store was unable to approve. Subsequently order was cancelled. did anybody experience the same issue and how to

    Have ordered Photoshop Elements 12 and Premiere Elements 12 (for MAC, EN version). Order went through but finally order was cancelled as Adobe Store was unable to approve. Subsequently order was cancelled. did anybody experience the same issue and how to proceed.

    Hi there
    Please check with your credit card issuer to see why payment is not being approved.  When this is resolved you should be able to place a new order.
    Thanks
    Bev

  • I uploaded the upgrade to Photoshop Elements 12 today.  I got a "dispatching error" for Photoshop Elements, but was able to download Premier elements!  I did not order Premier Elements, so I'm confused (unless this was a package that I did not know about)

    I uploaded the upgrade to Photoshop Elements 12 today.  I got a "dispatching error" for Photoshop Elements, but was able to download Premier elements!  I did not order Premier Elements, so I'm confused (unless this was a package that I did not know about).  I really want the Photoshop Elements upgrade - not Premier Elements.  I do hope I did not pay for both - I only want one.  Help!

    Maryrhire910 I am sorry that you are facing difficulty downloading and installing Photoshop Elements 12.  Are you downloading the installation files from Download Photoshop Elements products | 13, 12, 11, 10?  If so what specific error are you receiving?

  • WBS element for collective order

    Hello All,
    I have a production order with 5 subordinate production orders .
    For the order header there is a WBS element assigned .
    But for the subordinate orders, WBS should be the same as that of order header WBS.
    My problem here is , PO is created using CO10 . WBS is  input at the time of creation and available in order header only.
    But WBS field is empty for subordinate orders when displayed using CO03.
    Regards,
    Jyothi

    Hello All,
    I got the solution.
    There is a link between BOM header and items and WBS elements through table AFPO.
    If we input the WBS element, then it displays all the orders (Both BOM hdr and items)
    If the table entry is not maintained correctly, then there will be no WBS for that BOM items.

  • ROWNUM and order of elements in PL/SQL collection

    I have collection col of type tt_number is table of number.
    For example, values in collection are:
    col[1] = 123
    col[2] = -123
    col[3] = 999
    I'm running such query:
    select ROWNUM as "rn", column_value as "val"
    from table(col)
    Could I be sure, that my results always will look like:
    RN VAL
    1 123
    2 -123
    3 999
    Does ROWNUM equals to collection index?
    As I know, when querying tables, ROWNUM doesn't guarantee such things (unless querying "ordered by" subquery). But how about queries to collections?
    Regards, Dmitry Kuitskiy, 3-T Ltd, Kiev, Ukraine

    These Tom Kyte's threads can help you:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:1193224283514449959::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:4447489221109
    http://asktom.oracle.com/pls/ask/f?p=4950:8:1193224283514449959::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:3008276249843
    Rgds.

  • Error in file export when order of elements in build array changes

    Hi everyone,
    A while ago I wrote a vi file which does the following:
    At first it initializes a camera and chooses a region of interest (ROI). Data out of the ROI will be discarded.
    Then it raster scans a motor stage in x and y direction, in bidirectional mode (meaning that x alternates between scanning from left to right and right to left as y is inreased).
    For each point of the scan, the spectrum is collected, which is then integrated in lambda to give an idea of the total intensity.
    Then the intensity is plotted, along with the spectrum at each point.
    The final results are exported in a text file.
    The problem:
    If I flip the order of the wires in the "build array" before the file export, placing the Total Count (intensity) wire in place of the Spectrum wire, the file export fails. What I mean by "fails" is that the .txt file contains characters that look like chinese!
    Why is that?
    I attach my .vi as well as two screenshots which demostrate the problem.
    Solved!
    Go to Solution.
    Attachments:
    correct.png ‏182 KB
    Wrong.png ‏180 KB
    1.7z ‏119 KB

    mikeporter wrote:
    Hey Jeff... The changes you recommend are all good (and necessary) but the thing I'm stuck on is that regardless of what happens to the floating point data, there's that built-in VI that changes it to string representations of the numbers. And as I understand it, that is where the problem is.
    Mike...
    PS: Coming to NI Week?
    Not this year
    What scared me was the sgls on a SLs with no wire branch to force a data copy which, would force LabVIEW to preserve the sgls since the SL might need to be used again then, they get all mixed up building arrary out of mixed coerced sgls and dbls.  With the potential of a miss-reussed buffer (not uncommon in 2011) confusing the string operations in the write to spreadsheet.   The problem of course, must exist outside of write to spreadsheet file since it only exhibits with a build array element order change.  Or, we all are halucinating (Possible alternate theory)  
    Jeff

  • In Photoshop V5 -How do I keep photos in the same order when Exporting a Collection to a Folder

    Hi
    In order to resize photos ready for Premiere Elements, I am Exporting my Collection to a folder, from the Organiser.
    I then resize that Folder using Process multiple Files.
    I then can import that Folder into PE.
    BUT, the export seems to change the photo order to an apparent random order.
    The Collection is in the right order, and there seems no options in the export dialogue to impact the order in the exported file.
    Thanks
    Chris
    PS I am about to upgrade to version 7, but would like to get my process sorted out before then. maybe 7 does it differently.

    Hi DJ
    Thanks for the quick reply.
    The good news is that what you suggest simplifies my process a lot. So thanks for that.
    The bad news in the order in still wrong. I.E it's not as the collection order, but it is the same order as the Process Multiple file route!
    So a step forward, but not quite there yet.
    Thanks so far!
    Chris

  • Retrieve Last element from Collection

    Hi,
    I am a beginner in Java. Can somebody tell me how to retrieve last element from java.util.collection without Iterating?

    Hi,
    I am a beginner in Java. Can somebody tell me
    how to retrieve last element from
    java.util.collection without Iterating?You realize of course that this is rather silly since not every Collection necessarily has a "last" element. For it to have the notion of a "last" element it would have be ordered and would be a List.

  • Sale order - Wbs element Report

    Hi
    Is there any report for sale order wise wbs element report.
    In my sale order i will give wbs element and now i want to check "for one sale order , what are the wbs elements"

    You can check the WBS for a sales order from the table view of VBAP.
    The WBS field is PS_PSP_PNR.
    Goto SE16 and give VBAP.
    Enter your sales order number and execute. Look for your WBS elements in foeld PS_PSP_PNR for the different line items.
    You can also create a quick SAP query on this.

Maybe you are looking for

  • Replacing images used as a link with background image

    OK - I'm embarrassed to say that what I'm trying to do is blindingly obvious, and I've used Dw for several years - and do most of the work in code view but I'm having a senior moment and can't do what I want. I've read that when you use images on a p

  • New iMac & Aperture 2 & Photoshop CS4

    I'm purchasing a new 21 inch iMac, 3.33Ghz, 8GB, 1 TB, & ATA 4670. My ? is simply is this new imac appropriate for using these 2 programs? Raw photos. Nikon D90. Oops, 2nd ?. Does Aperture work with Ps CS4 fluidly, ie. without problems?

  • Encoding file size for standard DVD too large - please advise

    Hi - I shot an 6-hour training session that went well.  I shot it at 1280 x 720.  For the web version it will be no problem, as I'll just export to F4V. But i'm having a difficult time figuring out the export settings for the DVD.  I know that the di

  • Launchpad using trackpad

    SInce updating to ML, I find that the four finger pinch gesture to start up Launch Pad stops working a few hours after system startup.  F4 works, clickiing on the Launch Pad icon works, picking Launch Pad from Spotlight work, and the gesture is check

  • Adobe Presenter/ Edit Audio Feature

    I am struggling with Adobe Presenter and the edit audio feature. First, I am in a Win 7 environment with Administrator rights. Second, I am using MS Office 2010 (PowerPoint 2010) and Adobe Presenter 7.0 (as a part of Adobe E-Learning Suite CS4).   I