Order by the names in hashMaps which are contained within a collection

Hi All,
Is there a way to order by the names in hashMaps which are contained within a collection?
Collection-->hmp1(nrPerson1, nameB);
hmp2(nrPerson2, nameC);
hmp3(nrPerson3, nameA);
Now what i need to display is (nrPerson3,nameA), (nrPerson1,nameB), (nrPerson2, nameC)...
Any suggestion will be greatly appreciated!
Shuaibing

I just set the TreeSet with the values as you suggested, but the results seems to the same as usual, Can you check the following codes? I think I need have to give a initial parameter for the TreeSet constructor, but I do not know how to write the Comparator.
public String getIntermediaryCO(){
Contact contact=new Contact();
          Collection colnNrContactsInterCo=contact.getAllIntermediaryCompany();
          //test
          TreeSet treeSet=new TreeSet();
          HashMap hmpForOrder=new HashMap();
          if(colnNrContactsInterCo!=null && !colnNrContactsInterCo.isEmpty()){
               Iterator iter=colnNrContactsInterCo.iterator();
               while(iter.hasNext()){
                       HashMap hmp=(HashMap)iter.next();
                       hmpForOrder.put(hmp.get("name"),hmp.get("nrContact"));
          treeSet.add(hmpForOrder.keySet());
          //print the ordered, unique set
        Iterator iterator = treeSet.iterator();
        while( iterator.hasNext() ) {           
            System.out.println( "the list of sorted intermediary companies' names="+iterator.next() );
          //test
public Collection getAllIntermediaryCompany(){
           Collection colnContacts=new ArrayList();
           ContactCov contactCov=new ContactCov();
         try{
                String sql="SELECT DISTINCT NR_CONTACT from CONTACT_TYPE where CD_CONTACT_TYPE=5";
                jdbc = new JDBCConnection("1");
                rs=jdbc.executeQuery(sql);
                if(rs!=null){
                     while(rs.next()){
                               String nrContact=rs.getString("NR_CONTACT");
                               VOContact voContact=contactCov.getContactByNrContact(nrContact);
                               if(voContact!=null){
                                    HashMap hmp=new HashMap();
                                    hmp.put("name",voContact.getName());
                                    hmp.put("nrContact",nrContact);
                                    colnContacts.add(hmp);
              }catch(Exception e){
                  logger.error(e.toString());
               }finally{
                   try{
                        if(rs!=null)rs.close();
                        if(jdbc!=null)jdbc.close();
                   }catch(Exception e){}
           return colnContacts;     
        }     

Similar Messages

  • How to delete the messages from SXMB_MONI which are already cancelled .

    Hi All,
    The messages were earlier in System error(Red flag) state so i cancelled it manually.
    I want to know how to delete the messages from sxmb_moni which are already cancelled manually using ctrl+f8.
    if not possible , then i want to see them in earlier state i.e.., in System error(Red flag).
    can any tell me the procedure of doing it.
    thanks
    Sai.

    Hi AmitSri,
    Thanks for u r reply,
    What is retention period, where can i find this option.
    And i don't have authorizations to sxmb_adm --> configure delete procedure
                                                                             --> Define interfaces for archiving and retention period.
    and to RSXMB_DELETE_MESSAGES in se38 , i don't have authorizations to run
    Is there any way to delete the messages or make them to System error( Red flag) which are manually cancelled.
    Thanks
    Sai.
    Edited by: sai_SHA on Aug 17, 2011 12:29 AM

  • The names of my contacts are not showing up when I receive text messages

    The names of my contacts are not showing up when I receive text messages, only the number is showing up. How can I fix this?

    This is a HUGE iOS bug.. Following a tip from another poster, I was able to fix the issue (temporarily).
    This worked for me on Verizon.
    I dialed *228 on my Verizon phone. I pressed "1" to activate it over the air. I then went into task manager and killed all the running apps.. Waited a few minutes.
    The next text I got displayed the number correctly!.. Until I rebooted, that is.
    PLEASE, call Apple and speak with a senior engineer on this. They can't fix it if they don't know it's a problem! (800) MY-IPHONE

  • While synchronising it eats 1gb in the name of others which is specified by yellow colour may i know what is this

    while synchronising it eats 1gb in the name of others which is specified by yellow colour may i know what is this

    An other that large is due to corrupted files. To get it down to its normal of about 1/2 GB you need to restore you iPod.  Some times restoring from backup works but sometimes a restore to factory defaults/new iPod is required.

  • How to see the bussiness content querys which are on bussness content CUBE?

    Hi I need to find all the bussiness content queries which are there on  Bussiness content Cube? Can any one tell me where to find or see them in bussiness content ?

    hi,
    find the possible bi content queries in the following bi content help documentation.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/3d/5fb13cd0500255e10000000a114084/frameset.htm
    through application wise. expcrmerp analyticssdqueries.
    then go with bi content-object types-query elementsselect querythen double click the  select objects--here you can find the possible queries for each infocubes.
    hope this help you
    regards
    harikrishna N

  • Help!How can I find the name of a calling procedure from within a procedure/function?

    Is there anyway to find out the name of calling procedure(database) from within a database stored procedure/function? This is required for creating an auditing module.
    Thanks,
    Abraham
    ===========
    email:[email protected]

    You can use this query to get the procedure names that are calling your procedure.
    SELECT name FROM all_Dependencies
    WHERE upper(referenced_name) = 'YOUR_PROC_NAME'
    In your procedure, you can get these values into a cursor and then use them one by one.
    Hope this would help.
    Faheem

  • How can I view photos on the iPad in order of the name of the photo instead of the date the photo has been taken

    On the PC I edited the "file"names of photos in a photo-album, so that the photos are in a logical order after the file names. When I synchronise this photos with the iPad, they are shown on the iPad in the chronological order when the photo has been taken.
    How can I pursue the iPad to show the photos in the order of the "file"names of the photos instead of the order after the date of the photo?

    hello Allan
    Thanks for the answer. Wouldn't it be a nice feature on the iPad if you can choose on the iPad itself in which order the photos should be sorted -> for instance after capture date, after filename or after sorting in iPhoto
    Maybe this will be a feature for the next iOS release
    Urs

  • What is the name of table which supports processchain.

    Hi friends
    what is the name of  the table which supports processchain.

    Hi Beeram,
    You are thanking a poster for his answer.
    Please next time also give him points.
    See: /people/mark.finnern/blog/2004/08/10/spread-the-love
    This time I did it for you.
    Remember: When you ask a question you also assume the responsibility to assign points.
    Please check your other questions and if the answers were good.
    Spread the love and give some points.
    Thanks in advance, Mark.

  • Know the created info objects which are used in which info providers.

    Hi Experts,
    How can we know the zinfo objects which are used in which info providers.

    Hi,
    Either you can check the where used list of Infoobject as suggested by Gaurav, or you can goto transaction SE16 and put the table name as RSDCUBEIOBJ and put the Infoobject name.
    You will get the list of all Infoproviders in which the infoobject is used.
    Regards,
    Durgesh.

  • How to use viewslifetime managed property to get the list of sites which are least accessed?

    Hi,<o:p></o:p>
    I am trying to get the subsites of a site collection which are least accessed. I am using ViewsLifeTime managed property in a content search web part with a condition like this:
    ViewsLifeTime < 0
    OR
    ViewsLifeTime = 0.
    However, It is not giving any results. I even tried with ViewsLifeTime < 10. I have some subsites which are accessed less than 10 times. I came to know this when I saw the value of ViewsLifeTime
    property.
    Can anyone suggest how to add a condition on ViewsLifeTime property?
    Thanks in advance.

    Hi Mohan,
    Here is a thread with similar issue for your reference:
    http://social.technet.microsoft.com/Forums/en-US/770f100d-eadb-45d1-9305-15f11cf9038d/ctxcurrentitemviewslifetime-is-showing-null?forum=sharepointsearch 
    If you would like to get site usage report in SharePoint 2013, there is OOTB feature for you to view popular trends report for a site, you could refer to the link below:
    http://blogs.technet.com/b/tothesharepoint/archive/2014/01/28/view-and-configure-usage-analytics-reports-in-sharepoint-server-2013.aspx
    In addition, custom script for usage report for SharePoint sites might be more helpful to your requirement to know access times:
    http://blog.falchionconsulting.com/index.php/tag/audit/
    Regards,
    Rebecca Tu
    TechNet Community Support

  • How do i check the list of invoices which are not posted into sap.

    Hi All,
    Iam displaying(ALV) the list of invoices and epayments for both PO & non PO transactons which are being processed in workflow but not posted in sap.
    (Non po transaction is th eone with out reference of a PO)
    How to check and list out the invoices that are not posted in sap. where does this get stored.
    please help.
    Thanks
    jyothi.

    Hello Jyothi,
    U can give try with EKBE table for getting invoices for PO. In this table there is a field vgabe which has various status. U can try that. Now for Non PO, u would be directly creating invoice doucment using FB60(i guess) which would create an entry directly into BKPF/BSEG. U can scan BKPF for the date range company code document type KR which vendor invoice.

  • Can we get the list of Devices, which are connected to same Wifi?

    HI All,
    I am working with an iOS App which is related to Wifi-Network. I need to list out all the devices which are using same wifi connection, is there any way do. I have seen the Apples CaptiveNetwork, usinf that I can get the connected Wifi Info like SSID & BSSID, But I need fetch other devices info. I wanna connect to that device through wifi. Can anyone share with me please. Thanks in Advance.
    --Rajesh.

    You can't.  That information isn't available to an app.

  • How do I turn off the sound on ads which are on autoplay?

    There are ads on webpages that start playing sound for no reason at all and there appears to be no way to stop these sounds. So, I am forced to mute my computer until the ad stops playing which can be minutes or hours or until I find the webpage that is playing the sound. In IE, there is a way to turn off sound from webpages but I haven't found that in Firefox yet. Perhaps this is something you can fix.

    Try these about:config settings
    :media.autoplay.enabled user set boolean False
    :browser.sessionstore.max_concurrent_tabs user set integer 0
    I notice that the second one for me is 3 (default), don't know if I changed it or or if Firefox did.
    '''More information on configuration variables''' available in
    [http://kb.mozillazine.org/About:config_entries about:config (entries)] and for users not familiar with the process there is [http://kb.mozillazine.org/About:config about:config (How to change)] -- Specialized list of only [http://dmcritchie.mvps.org/firefox/tabs_config.htm Tabs configuration] variables.

  • Is there any way in Mavericks to go back to the old "line label" color strips instead of the new mini dots, which are virtually worthless they are so small and faint.

    Is there any way in Mavericks to go back to the "full line" color label as opposed to the mini dots, which are too small and faint and virtually worthless?

    Unfortunately, not.
    You can file feedback here. The more who file the more chance it will get done.

  • How to get the details of Transports which are yet to be imported

    Hi Experts,
    Kindly let me know how to get the Transport request details which were not yet imported.
    For example:
    We have two client in development system 300 and 400, The transports which are created in 300 and imported to 400 (in SCC1).
    I need to know the details of transport requests related to 300 which are yet be to moved to 400.
    Where can i get these details.
    Thanks,
    Narasimhan Krishna

    Narasimhan,
    Take a closer look at Yves KERVADEC's approach. The issue here is that typically SCC1 is used to move transports which have not yet been closed.  You can see the details of any transport via se01/se09/se10, whether open or closed, but my interpretation of your question is that the customer wants to know which transports have been imported into the unit test client (400) via SCC1, which transports have been brought in by the transport system (after they were closed), and which transports have not yet been sent to either the unit test or QA system (i.e. are still open).
    My guess is that you are trying to track down why things work in the unit test client and not in the QA client. That is actually a different question with a different approach, but if that's what you really want to answer, go ahead and ask that question in a separate thread and you'll get a ton of techniques.
    Back to the question you actually asked: By writing a query, you can get a list of transports which have been brought in to the unit test client via SCC1. You can also get this information from SCC1 --> Goto --> Log Display. Then click All Transport Requests and doubleclick on the client. This will give you the import log of your unit test client with date/time stamp. Analysis of that data indicates to me that perhaps you may want to look at CC0_RSCCPROT03_ALV, but I'm not an ABAPer so the previously mentioned tables are probably better.
    Anyway, once you have a list of transports which have been imported, you can subtract out the ones that have been closed and transported downstream (and back into the unit test client.. your transport path does re-import the final version of the transports into the unit test client... right?). You can get that information from another query or you can get the list from STMS as suggested by Aparajit Banik.Then you'll have a list of transports which have been imported into the unit test client via SCC1 but have not yet been released and made it downstream. This will give you a "hit list" of transports which might be causing a mismatch between your unit test and QAS clients. You would then inspect them more closely with SE09/SE10/SE01 (I prefer se01, but different folks prefer different version of the transaction).
    Again, there are better ways to deal with client mismatches, but I'm answering the question you asked in case I misunderstood the underlying subtext.
    I hope this helps!
    Best regards,
    --Tom

Maybe you are looking for

  • Is it possible to hide the HD icon in the desktop?

    It annoys me... Also, can anyone recommend me a site where I can download new Dock/menu bar themes?

  • Bug in XML DOM

    there is a bug in XML DOM API in Safari for Windows. The same bug was in FireFox 2 https://bugzilla.mozilla.org/show_bug.cgi?id=206053 Hmm... how to report it to Apple?

  • Migrating HTMLDB v. 2.0.0.00.49 to ApEx v. 3.1.2

    Hello. I am plannning an upgrade path for our old HTMLDB application to latest and greatest ApEx. We are running a prod app and our management does not allow us an "upgrade" of that environment. Instead, I have to create a new ApEx environment and so

  • Bypass proxy for certain sites

    ls, Can I configure BM in such a way that it bypasses itself for certain sites? So, rather then setting the exclusion list on every PC? For certain sites/ip-addresses we need to go out via another gateway. I have done this now by putting the address

  • Can I get away with 150ppi?

    Hi, Im designing a poster (A3). As I know 300ppi is the acceptable standard for high quality printing but Its not a simple task to find materials in that resolution. What you think-can I get away with 150 ppi instead? This poster is for educational p