How can I get keys from Hashtable in the same order?

Hello, everyone.
I have a Hashtable containing key-value pairs, I need to get the keys in the same order as I use
method put(key,value) to save the key-value pairs. But I can only find Hashtable.keys() to fetch the keys in form of Enumeration and when retrieve the keys from the Enumeration,they are not in the original order!
The following is my code:
Hashtable ht = new Hashtable();
ht.put("Name","Harry Bott");
ht.put("Gender","Male");
ht.put("Age","25");
String[] Items = new String[ht.size()];
Enumeration e = ht.keys();
int i = 0;
while(e.hasMoreElements()) {
Items[i++] =(String)(e.nextElement());
The Items contains the keys but they are not in the original order.
Does anyone know how to get the keys from a Hashtable in the same order when they're put?
Thank you!

yeah, another solution is to stored keys on a Collection at the same time you put them on the HashMap with its values.
Then when ur going to retrieve objects from the Map u iterate the Collection that has the ordered keys and use them.

Similar Messages

  • HT201302 Hi People! please help...I want to know how can i get photos from ipad to the computer, that were synchronized previously to ipad but from another pc that i dont have access anymore and these pics are now only found in this ipad and no other plac

    Hi People!
    Please help...I want to know how can i get photos from ipad to the computer, that were synchronized previously to ipad but from another pc that i dont have access anymore and these pics are now only found in this ipad and no other place.

    Hi Alan,
    Thanks for the help, but i've actually done that before.
    It does not help, because it only shows the photos on the camera roll and do not show the photos synchronized with that pc that i dont have access anymore.
    The photos/albums all appear on the ipad, i can see it without problems but i cant get them out of the ipad to save onto pc for backup.
    And i reaaly need it, as it is the only place that i actually have these photos now...

  • How can I get iCal not to show the same birthday dates from my iCloud

    How can I get iCal not to show the same birthday dates from my iCloud?

    You don't need them stored locally for a backup. You can manually export your contacts as archive for backup. Also, if you are backing up with Time Machine, you already have a backup. If your hard drive crashed, you would have to rely on your backup or iCloud anyway.
    So, if you're comfortable with that, sign out of iCloud. Choose to delete contacts from the computer. When you sign back into iCloud, you should only have iCloud contacts listed in AB. When you open iCal, you should only have one listing for birthdays.
    The other alternative is to disable the Birthday c.alendar and create one manually.

  • How can I get my ipad to reflect the same playlist order that appears on my computer?

    How can I get my ipad to reflect the same playlist order that appears on my computer?  My computer has the exact desired order of playlist, but once the system is synced, the ipad does not reflect the propper order.

    In iTunes with your playlist shown in the correct order, right-click on the playlist name in the side-bar and click Copy to Play Order. Enable the side-bar with CTRL+S if necessary. Sync. Note also that the column you are sorting on should have the small triangle pointing upwards, otherwise the songs will play in the reverse order. You may also find that you need to first remove, and then add back the playlist to the device if syncing doesn't update it properly. See this post for more.
    tt2

  • How can I import photos inro Organiser in the same order as they are in my files?

    How can I import photos into Organiser in the same order as they are in my files?

    You can do a change to your files you want to import so they are in order that your version of PSE uses.
    One of the benefits of PSE is that you are no longer limited to specific order or locations of pictures. If you want a spefic order for display purposes create an album and your order will be maintained in the album. Other than that I keep my display on Newest first(I have PSE 11) and rarely change it.

  • Downloading TV shows from itunes - episodes appearing seperately not all under the same series despite all the information being the same.  How can I get them to appear under the same series

    Just that
    I have many series - NCIS, West Wing etc where some episodes appear under the series and some appear on their own.
    I have checked the info anf they appear to be identical.
    How do I get them to group together corectly?

    After a couple of days, I'm noticing that the repeat(ing) offenders have more than 10 episodes, and seem to keep repeating them every time I sync.
    They only show once in my phone and in the iTunes Podcasts, but through iTunes and looking at what's in my phone is when I see the repeats.
    Even after I've marked a podcast as played, and deleted it from within my phone, as well as telling iTunes to delete the played episodes, it still shows multiples of the played episodes.
    There doesn't seem to be any rhyme or reason to it either. They aren't the newest ones either.

  • How can I get a container to be the same size as all its children

    In my TitleWindow, I have two children that size themselves
    dynamically.
    No problem, TitleWindow also sizes itself to completely show
    both children.
    Now I have an additional child that I can only position
    correctly if I set TitleWindow's layout parameter to absolute.
    The third child now positions itself correctly on top of the
    first child.
    But now TitleWindow is only as big as the first child and I
    have to scroll to see the second child.
    How can I force TitleWindow to be the size it was when layout
    was set to vertical?
    Doug

    Hi Doug - What exactly are you trying to do? Is the third
    child being added dynamically, and you want it added above the
    first child? If so, you can use the addChildAt() method when adding
    the child to the container. addChildAt() takes an index and the
    child object is added at that index and all other children are
    reshuffled to maintain the ordering. IE:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:TitleWindow layout="vertical" id="tw">
    <mx:Button id="a" />
    <mx:Button id="b" click="go();"/>
    </mx:TitleWindow>
    <mx:Script>
    <![CDATA[
    private function go():void
    var c:Button = new Button();
    c.label="new";
    tw.addChildAt(c, 0);
    ]]>
    </mx:Script>
    </mx:Application>
    Does that help, or am I misinterpreting what you're trying to
    do?

  • How can I get my website to display the same in multipul browsers?

    I am having trouble displaying my webpage in different browsers. I have run it through html & css validators and they can't pick up on any faults which would through the site out of line.
    When I display the same code on different computers, different aspects of the pages change even though the files are exactly the same.

    Start by running your page through the validator:
    http://validator.w3.org/
    You have some elements which are not nested properly such as scripts running outside of the head and body, required attributes missing, tags missing opening or closing, a <br /> tag in between </td> and <td>.  Then you can ignore the stuff about Flash because the Adobe codes for Flash and Spry never seem to validate.  Some of the other errors at the bottom like no </body> tag can be ignored because they are there, it just means there is a tag not closed before the end of the body so it generates an error saying the body was not properly closed.  The lines below that with tag mismatches will help you determine what is and what is not closed.
    If you get that done and still have errors please let us know what browser/version/error you are having an issue with.

  • How can I get my photos back in the right order?

    I recently reset my iPhone 4s, having backed it up.  When I re-synced it my photos were all in the wrong order, they seem to be displayed in some random order.  For example, four photos that I took one after the other are now scattered among other photos.  I would like to have them in date order, but can't seem to do this.  I know I have to do it on my computer first, and am running Windows 7.
    Can anyone help?  All I want is my photos back as they were before I reset the phone.

    Thank you.  I had actually done that, and then could not re- sync my iPhone.  It connects to iTunes and is recognised, but does not sync, although the bar at the top sys it is synching , and goes through the process very quickly.  But in the end I still have my photos in the old order on the iPhone, and no music at all!

  • How can I get a banner that stays the same?

    I basically want to have a banner on my website like the adobe one at the top of this very site. Where however far you scroll out it can always be seen. I also want to know how to do this with my background image. I know how to stop it from scrolling just not scalling. Thanks, for your help!!

    CSS:
    body  {
    background: #000 url(your-BG-image.jpg) no-repeat center center fixed;
    /**for Safari,Chrome**/
    -webkit-background-size: cover;
    /**for Firefox** /
    -moz-background-size: cover;
    /**for Opera**/
    -o-background-size: cover;
    /**for other browsers**/
    background-size: cover;
    Nancy O.

  • How can I get my layout to look the same across multiple browswers?

    Hello forums!  How are you guys?
    I use Dreamweaver to edit my layout for my site.  However it looks fragmented on certain browsers and perfect on others. 
    www.ifuxkswiththat.com is the site.
    Is there something that can keep this uniform amongst other browsers?
    Check it on yours...it might work for you and it might not

    Your best bet is to get it right in something like Firefox or Safari, and then use some conditional CSS to tweak it in IE browsers.
    So put things like this in your header :
    <!--[if IE 5]>
    <style type="text/css">
    /* IE 5 does not use the standard box model, so the column widths are overidden to render the page correctly. */
    #outerWrapper #contentWrapper #leftColumn1 {
      width: 16em;
    #outerWrapper #contentWrapper #rightColumn1 {
      width: 16em;
    </style>
    <![endif]-->
    You can specify the particular IE browser above or use, for example <!--[if lte IE 7]> for IE 7 and below, or <!--[if lt IE 7]> for IE 6 and below.

  • When i click on a photo file in windows , elements opens, then i have to go back into windows and click again to open file , earlier version opens program an file how can i get elements 12 to do the same?

    Elements

    The way I got around the situation was to write a custom folder action and attach it to my Downloads folder. The good thing about this is that it works irrespective of the browser du jour I'm using.
    This way you can define any filetype you're interested in to auto-open when a file is created in the Downloads folder (or any other folder of your choosing).
    It's not that tricky to add. I think I posted the code here many moons ago so I'll try and track it down...
    Edit: It was a post to macosxhints.com that I last linked to: http://www.macosxhints.com/article.php?story=20050122214044554#comments
    Hope some of that helps.

  • How can I get values from listbox?

    Hi all,
    I need to get price values from Price List (Inventory -> Item Master Data screen). It's important to get values from field 'Price' BEFORE item will be added/updated.
    How can I get values from Pricelist listbox?
    Thanks for any suggestions or short sample code.
    Best regards,
    Andy

    Hi Andy
    Here is som sample code that will get the description of the price list and also the price that is displaying at the time. The item master must be open for this snippet of code
      Public Sub GetItemPriceFromOpenWindow()
            'this is assuming item master is open
            Dim oEdit As SAPbouiCOM.EditText
            oEdit = SBO_Application.Forms.GetForm("150", 1).Items.Item("34").Specific
            SBO_Application.MessageBox(oEdit.Value)
            Dim oCmb As SAPbouiCOM.ComboBox
            oCmb = SBO_Application.Forms.GetForm("150", 1).Items.Item("24").Specific
            SBO_Application.MessageBox(oCmb.Selected.Description)
        End Sub
    Hope it helps

  • HT203167 lost my hard drive how can i get songs from ipod back to new computer

    I lost my hard drive and want to get my music back on my new computer. How can I get songs from my ipod to my computer? I am afraid to sync it and losing what is on my ipod. Any help would be appreciated.

    It has always been very basic to always maintain a backup copy of your computer for this very occasion.
    Use your backup copy to put everything back.
    If for some reason you have failed to maintain a backup, not good, then you can transfer itunes purchases from your ipod:  File>Transfer Purchases

  • How can I get Data from the Sound cart in Labview? Does a VI exist?

    How can I get Data from the Sound cart in Labview? Does a VI exist?

    Yes, there are VIs for acquiring data from Sound cards. And examples too. If you don't have LabVIEW yet, do a search on NI's site for example VIs.
    Khalid

Maybe you are looking for

  • ITunes becomes a white box

    For some reason, lately iTunes has become a white box at times. I don't know how better to describe it. It seems to happen when I am syncing with my iPhone. The entire iTunes window goes white, although I can still see the menus above (File, Edit, Co

  • Downloading the right iBooks version for iPad 1: solution!!!

    Hi, I needed the right iBooks version for my iPad 1. What I did was: I used my iPad 1 to go to the app store. Once there I looked up 'iBooks'. When I tapped on it to download it it asked me if I wanted to install an older version. I tapped OK and it

  • Nokia E71 G Talk not working

    java.lang.nullpointer Exception0=2 error while starting up the application please restart. this message is getting while opening the application

  • PANIC: fatal region error detected

    i encoutered this error for stress testing. in the project, we used the transaction and cursor. when the application is runing for a long time, i will receive the err about "PANIC: fatal region error detected". i change the max numbers of transaction

  • Re email address if you leave

    Hypothetical. If person leaves BT broadband is there a way to keep the BT address ? Life | 1967 Plus Radio | 1000 Classical Hits | Kafka's World Someone Solved Your Question? Please let other members know by clicking on 'Mark as Accepted Solution' He