How to keep the original sequence of a map

I want the equivalent of a Hashtable or Map class (I need keys and corresponding objects) which, once fully populated, will guarantee to get the key/object pairs back out using the order in which they were added, rather than by sort order of the keys.
( The bigger objective is to compare two such collections, A and B, to see which key/object pairs exist in A but not B, and which exist in B but not A. However, for presentation purposes, I need to keep the original order in which everything was read.)
What's the most efficient way to do this ? I'm sure I've missed something really simplistic but, hey, it's Monday......

There is no way to retrieve objects from any map in the order they were incerted unless you add some logic to the way you are incering it.
Here is an example of such logic, where I want to retrieve "states" in the same order as I put them:
     public static void main(String[] args){
          HashMap map = new HashMap();
          map.put("1" + "PA", "Pensylvania");
          map.put("2" + "NJ", "New Jersey");
          map.put("3" + "CA", "California");
          map.put("4" + "TX", "Texas");
          LinkedList ls = new LinkedList(map.keySet());
          Collections.sort(ls);
          Iterator iter = ls.iterator();
         String stAbbrv = null;
          while (iter.hasNext()){
               stAbbrv = (String)iter.next();
               System.out.println(stAbbrv.substring(1) + " - " + map.get(stAbbrv));
     }the output is:
PA - Pensylvania
NJ - New Jersey
CA - California
TX - TexasHope it helps
Alex
[email protected]

Similar Messages

  • How to keep the original imovie quality as much as possible?

    I've completed an iMovie project which lasts a few minutes short of one hour. The size of the iMovie project is 12Gig.
    I want to burn this to a dual layered DVD using iDVD, and at the same time maintain as little compression as possible, keeping the quality has high as possible.
    What is the best way to do this? Because when I export the iMovie file to iDVD using the create iDVD Project, and set my iDVD prefs to "Best Quality", and my "Media Type" to 8Gig (Double Layer) I end up with an iDVD project file of 3.39Gig.
    How is it possible to create a DVD from the 12Gig iMovie file which, when compressed, will be larger than 3Gig, so as to use most of the disk space on an 8Gig disk.
    It seems that the only two encoded settings I can alter are for "Best Quality" and "Best Performance". I was hoping to get at least 6-7Gig, thereby only compressing the original movie by half, instead it's compressed it down to a quarter of the original size. Judging the original movie against the DVD version on a TV screen reveals a noticeable amount of quality loss. Is there anything that I can do to force iDVD to not compress the file this much??
    iMac G5   Mac OS X (10.4.2)  

    I was hoping to get at least 6-7Gig, thereby only compressing the original movie by half, instead it's compressed it down to a quarter of the original size. Judging the original movie against the DVD version on a TV screen reveals a noticeable amount of quality loss. Is there anything that I can do to force iDVD to not compress the file this much??
    Sorry, the video content must be compressed to a certain level to be playable in DVD players - it's a matter of the bit-rate that DVD players can handle.
    iDVD's 'Best Performance' produces a disk with about as high a bit-rate that players can handle. Because MPG-2 compression works on frame to frame differences, to maximize your DVD quality do things like place your camera on a tripod and make sure there is plenty of light.

  • After receiving an e-mail and forwarding it on everything ends up in Sent including the one I received. How do I keep the original in my Inbox?

    Some mail disappears from my inbox and I have discovered that if I have to answer or forward the original e-mail it disappears permanently and the original and the reply/forward e-mail all end up in my Sent box - which is emptied each month at the moment. Any ideas how to keep the original in my Inbox? Has only happened since updating to maverick.

    where on my computer am I suppose to make the individual picture files and have them to upload on my ipod touch.... I do have a photo library on my computer, but in the photo tab in itunes for the ipod touch and there is nothing checked for syncing, cause when I do check it it always says its going to replace everything i have in my photo library on my ipod touch.....  So how am i suppose to have it checked and have it NOT replace pictures on it????
    Also I cannot make more photo albums into my ipod touch, it just replaces the one album every time....
    I am very frustrated cause I have tried the manuals and the apple support help etc and nothing pertains to my exact issue.....
    Please if u could elaberate I would appreciate it alot..... 
    thank u

  • HT2204 My husband and I have the same apple id. We would like to each have our own. He will keep the original one, but how do I get a new apple Id and keep all the things I have associated with the old apple id?

    My husband and I use the same apple Id. We would like to each have our own apple id, but we do not want to lose all our information associated with the current id. One of us will keep the original. If one us creates a new apple id how will that affect the iPhone and iTunes?

    That would be my suggestion.  Just keep using the common one for purchases in the stores.  Then each get another AppleID using a free gmail, AOL, hotmail, MS Live or whatever email account.
    Delete your current iCloud account and login with the new AppleID, and logout of Messaging and then backin with the new AppleID.  Now you have a shared iTunes/App store account, but completely separate, independent iCloud and iMessage accounts.
    You can still share calendars if you wish to, even across separate accounts - http://support.apple.com/kb/ph2690

  • How to export a file keeping the original timecode

    Hello all,
    I'm struggling to find out the way to do the following:
    I have an entire footage file and from that I need to cut specific interviews to be translated however I must keep the original timecode where I extracted these interviews from so the editor knows where to place the subtitles (as s/he will be using the file as a whole and because it is a foreign language they won't know the correct place).
    Does anyone know how to do this? Using FCP7 btw.
    Thank you so so much!!!

    You cannot export a single QT file that has multiple timecodes embedded into it.  What you can do is drop on the TIMECODE READER filters onto the clips so that they visibly show the timecode on the screen as reference.

  • Acrobat 5.0 How do I keep the original file name after I have converted a Word doc to PDF?

    MY colleague has a certain setting in Acrobat that allows him to keep the original file name when he converts documents from Word to PDF. Every time I convert Word, Acrobat overwrites the filename and names it "untitled.pdf". I would like to retain the original name and for Acrobat to simply add the .pdf file extension to the original name. How do I do this?

    I have no idea what you are doing for sure. Does your WORD document have a name. I opened a WORD document and selected the Acrobat Distiller printer for AA5, I got the file menu for selecting the name and it was automatically filled in with the DOC changed to PDF. If you are using PDF Maker, then you will need to search there - I removed PDF Maker for AA5 years ago and can't view that part. I see the same types of options in PDF Maker for AA8.1.2 as I saw in the printer for AA5 and guess it is the same. The untitled.pdf suggests that you never saved the original DOC file so it has a name.

  • I am exporting a Pages document to Epub and Pages is compressing my jpg images.  How do I keep the original jpg size during the export to epub process?

    I am exporting a Pages document to Epub and Pages is compressing my jpg images (I think to 72 dpi from original 600 dpi). 
    How do I keep the original jpg size during the export to epub process?

    We are still trying learn how to use Pages to build ePub documents with high resolution graphics that will expand clearly when they are tapped. Very large screen shots are my example here.

  • Exported video size smaller than original video size. How do I keep the original size?

    I exporting a video from Adobe Premiere CS6 today, and I noticed the video was about 1/2 times smaller  than the original video I put in. I then uploaded the video on YouTube, and the size was still the same. I tried to change the preset to 1080p 29.97, 1080p 25, etc. and the same with 720p, and 480p, but the size only changed slightly.
    How do I keep the original size after exportation of videos?

    More information needed for someone to help... please click below and provide the requested information
    -Information FAQ http://forums.adobe.com/message/4200840
    Also, exactly what are you editing, and what are your export settings?
    Also, The tutorial list in message #3 http://forums.adobe.com/message/2276578 may help

  • How do I keep the original pre-RAW preview exposure ?

    IF I understand it when I imort a RAW "NEF file from my Nikon, LIghtroom shows a preview that is a jpeg exposre, something equivalent to a point and shoot photo. Then after processing the info from the RAW file, it shows the unprocessed image. Typically, this image for me becomes unsaturated and less colorful. Although I want to process "some" of my photos, I like some of the point and shoot images, and I'm wondering how do you keep the original exposiure that LIghtroom shows before showing the RAW unprocessed image?
    When I'm taking photos just to archive a thing, I like the advanced point and shoot saturated image. When I want to be artistic, I prefer to process them myself. Is there a setting that will allow me to keep the preview look?

    natekon wrote:
    Is there a setting that will allow me to keep the preview look?
    Aside from what Lee Jay said (which is technically accurate) the best thing you can do is to learn how to quickly make image adjustments and if you find you are making the same adjustments all the time, create a preset or consider making a new Default tone/color adjustment for your images. The fact is that the EFIX JPEG is the camera maker's interpretation of the raw image. It's neither accurate nor sacrosanct. It's simply a different rendering of your raw data. You can look at using different DNG profiles (in the Camera Calibrate panel) to alter the color rendering and adjust your tone controls to taste and make a preset or a new Default.
    But in answer to your main question can you use those JPEG previews as a basis for LR, no other than you make the manual adjustments yourself...

  • How do i keep the original manual sort of my photos that i had in previous library after a rebuild in iphoto library manager?

    how do i keep the original manual sort of my photos that i had in previous library after a rebuild in iphoto library manager? and keep the events in the same order with blank events also

    Not sure you can.
    Library Manager creates an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.

  • I've a video with an extra translator voice how can I remove the translator and keep the original voice ?

    I've a video with an extra translator voice how can I remove the translator and keep the original voice ?

    I got the quicktime 7 pro but that did not solve my problem I need to listen to the origenal voice on my video  however  in window properties there is only delete the it deleted all the voices together :'( helllllllllp someone

  • Having trouble figuring out how to save the original photo after I've cropped it - i.e. I want to create a headshot of my husband from a photo of the two of us, but I also want to keep the original. Seems very basic, but can't seem to figure it out. Any h

    Having trouble figuring out how to save the original photo after I've cropped it - i.e. I want to create a headshot of my husband from a photo of the two of us, but I also want to keep the original. Seems very basic, but can't seem to figure it out. Any help would be great!

    Use File >> Save As
    Choose a different file name so as not to overwrite the original and don't save any changes when closing the original.

  • How to get the original version of Web report in BW ?

    Hello Friends ,
    I have transported one Web report from BW development to BW Production System.
    But unfortunately , the desired result not me met .
    So I have been asked to keep the original version of the Web report.
    As the new version of Web report has replaced the previous one ,
    So could anybody tell me how to get the original version of Web report in BW ?
    Many thanks in advance !!!!!!!!

    Hi,
    You can use the Transaction STMS choose the option "Import Overview" . In the GOTO tab select "History" and choose "Import History".
    Here you can find the history of requests imported to the prod system.
    Regards,
    K.Manikandan.

  • Print to file, keeping the original filename

    Lightroom – Print mode - Print to JPEG file - Print to file. Use: All filmstrip photos. Question: How do I Print to file and save all filmstrip photos with the original names? Seemingly I can only do so image by image by typing the original name. Furthermore the original name is not saved in the metadata when using Print to file. I want to print multiple photos keeping the original name andI do not mind if a digit is added to the end of the name. It should be possible non? I never do away with the original name.

    I have the same question

  • Working on keyframes in a copied sequence changes the original sequence as well (Premiere Pro CS5.5)

    Hi everyone,
    maybe this is a very basic question, but the search in the forum didn't bring up any related questions, so here i go:
    Let's say, i copy a sequence in Premiere Pro CS5.5 and paste it in the same project. I have some textclips with keyframes in them. (I do this, because the videos stay the same, i just write different things into them. When i change the keyframes in the copied sequence the way i need them there and then go back to the original sequence, the keyframes there were changed as well. This is not what i wanted.
    My question therefore is: How can i make a copy of one sequence and then work on it without changing the original one at the same time? Why are they linked anyway? Is that just a selection in my version of Premiere Pro or is that a general thing?
    Would be great, if someone could explain that to me.
    thanks!

    If you have not done the New Title Based on Current Title, what you have are Instances of that Title, and they are all linked to the original Title. Make a change, and it is global to all Instances. This is very useful, if for instance, you have a typo. Say that you have used the old Western moivie cliche Title "Meanwhile Bock at the Ranch," a dozen times, only to discover the typo. You only have to correct "Bock" to "Back" one time, and it corrects all Instances of that Title.
    With New Title Based on Current Title, you have separate, individual, and un-linked Titles, so any change will ONLY affect the Instances of THAT Title.
    While the Instances can be very useful, one can be easily confused, when a change to one Instance affects all others.
    Good luck,
    Hunt

Maybe you are looking for

  • One to one appointment

    I know this is the wrong place to post this question but no option is given. How do I get to the actual page to sign up for a one to one appointment.  I am already a member.  But the Apple web site is not user freindly at all. Thanks

  • Do you guys know of any good tutorials?

    In my home I have 3-4 computers which we often use to play games online/LAN together. I have been using flash for several years and messed around with actionscript quite a bit. I was hoping to develope a game that supported a small number of players(

  • Minimum block size for DMA transfers

    Can't find Application Note 011, "DMA Fundamental on Various PC Platforms" on the NI website. Can someone please send me the link? What I'm trying to figure out is what is the packet size (chunk size) for DMA transfers on NI M series boards? i.e. how

  • [nVidia Series] P4N Diamons and Windows Vista drivers

    Hi, Trying to install Windows Vista but with no luck. In the setup when starting from DVD it refuse to use the Windows XP drivers og don't find the harddisk without them. When installing from Windows XP it crashed in bluescreen after reboot when cont

  • Migrating local users failed with migration tool

    Getting an error trying to migrate local users from windows server 2003 R2 (X86) to windows 2008 R2. There is no domain involve in our environment. Both are workgroup servers. By following the steps given by Microsoft, trying to export local users an