Is there a standard map sorted by values

Tree Map is sorted by keys..Is there standard jdk map sorted by values ?

You can also use a method similar to the following:
private static final Collator PL_COLLATOR = Collator.getInstance(new Locale("PL"));
     public static <E> Map<E, String> sortMapByValue(Map<E, String> unordered) {
          Map<E, String> ret = new LinkedHashMap<E, String>();
          Set<Entry<E, String>> sort = new TreeSet<Entry<E, String>>(new Comparator<Entry<E, String>>() {
               public int compare(Entry<E, String> o1, Entry<E, String> o2) {
                    Entry<E, String> e1 = o1;
                    Entry<E, String> e2 = o2;
                    String s1 = e1.getValue();
                    String s2 = e2.getValue();
                    return PL_COLLATOR.compare(s1.toLowerCase(), s2.toLowerCase());
          sort.addAll(unordered.entrySet());
          for (Iterator<Entry<E, String>> iterator = sort.iterator(); iterator.hasNext();) {
               Entry<E, String> e = iterator.next();
               ret.put(e.getKey(), e.getValue());
          return ret;
     }

Similar Messages

  • Is there any standard ODS for Contract (value type and quantity type)?

    We know that in MM, contract records can be categorized into two different categories, Value type and Quantiy type.  We are trying to see if there is any Contract ODS in business content that we can install which can take care of these two types of contract records that we can bring them over to BW from R3?
    Thanks

    Hi Kevin,
    Please see this link,ODS looks related to your requirement.But seems its for CRM and not for MM.
    http://help.sap.com/saphelp_nw04/helpdata/en/38/c3813ed9d23e44e10000000a114084/frameset.htm
    cheers,
    Vishvesh

  • Sort variable values in selection box in BEx web report.

    Hello friends,
    In my BEx web report I have cal/month selection. When I do dropdown to select values it starts with 01/1960 and I have to click 10 times to get to 01/2006, 02/2006 and so forth.
    Is there a way to sort these values so I can get most current cal/month in first list?
    Thanks in advance.
    Regards,
    BJ

    I would consider changing the read mode for the dropdown box.  Are all of those dates actually relevant?  Check out the properties of the dropdown box in WAD. 
    Thanks,
    Jeff

  • Sorting the values in Map

    Hi,
    In my application, i want to use Mapping in the case
    Key -Value
    A - 2
    B - 3
    C - 7
    D - 5
    For that I used HashMap. But I want to sort the values and place in map as from Highest order. For that in google it is suggested to refer SortedMap. But this SortedMap is sorting the Key content only not Value content.
    For sorting the Value's what I have to do under Collection?
    Any idea?

    DHURAI wrote:
    I will explain my concept in detail.
    I am having a String array; a[]={qw,q,as,l,kj,q,q,l}
    From this i am mapping
    key value
    qw 1
    q 3
    as 1
    l 2
    kj 1
    using HashMap.
    From this I want to fetch q whose value is greater. How can I do this?
    Hope this explains better.You still haven't said how often you want to do that. What I explained will work, but it might not be what you want if you often change values.

  • Sorting the values of a map.

    I have been stuck on this problem for a while. I have a TreeMap, which can be changed to a HashMap if needed, with a set of keys as Strings and values which are Integers.
    EXAMPLE
    String1, 123
    String2, 333
    String3, 222
    String4, 758
    I need the values sorted in decending order (9-0).
    Thanks in advance for all your help.

    I have been stuck on this problem for a while. I have
    a TreeMap, which can be changed to a HashMap if
    needed, with a set of keys as Strings and values which
    are Integers.You must be the first one who changed a TreeMap into a HashMap and then lived to tell about it. -:)
    Anyway a TreeMap is always sorted on key, not value. To have your dataset sorted on value you must reload into another TreeMap and invert the key/value pairs in the process. The values then become keys in the new TreeMap which means that the former values must be unique for this to work.
    I'm sure there's a simple solution but it's better if you described what you want to accomplish in general terms than to let people struggle with a solution scenario that's probably suboptimal. How do you want to access your objects and why and when do you need them to be sorted.

  • In filling out a form with a list of names, is there a way to sort it, such as an alpha sort?

    Is there a way to sort names in adobe?  Such as when filling out a form?
    Or should I just give up and do the industry standard and use excel?

    Reader cannot do what you want. Yes you can use Excel, Numbers, and a dozen other spreadsheets. Or you can use database software (I tend to use FileMaker Pro and FileMaker Go, but there are many other choices), you can also use Form software (which again is just a simple database).

  • Sort F4 values in BEX variable screen

    Hi ,
    Does anyone know how to sort F4 value help in BEX variable selection screen. This query has come up time and again in SDn and there seems to be no proper reply to this. If anyone has worked on this do let me know.
    Thanks,
    Vaishnavi

    Hi Nara,
    Kindly have a look at below thread,
    Sort the values in Bex query variable screen
    Hope this helps.
    Regards,
    Mani

  • COLLECT: Which table is better to use - STANDARD or SORTED?

    Hello Performance gurus,
    I read this curious fact about COLLECT statement:
    In standard tables that are filled using COLLECT only, the entry is determined by a temporary hash administrator. The workload is independent of the number of entries in the table. The hash administrator is temporary and is generally invalidated when the table is accessed to be changed. If COLLECT statements are specified after an invalidation, a linear search of all table rows is performed. The workload for this search increases in a linear fashion in relation to the number of entries.
    In sorted tables, the entry is determined using a binary search. The workload has a logarithmic relationship to the number of entries in the table.
    In hashed tables, the entry is determined using the hash administrator of the table and is always independent of the number of table entries.
    So does this mean if we're populating a table using COLLECT we should prefer STANDARD over SORTED(due to the HASH administration)? Is there any performance overload while setting up the temporary hash administrator for STANDARD tables?
    Please enlighten me.
    BR,
    Suhas

    Actually I have just noticed I already had created a test program for this somewhere in the past.
    Here are the results:
    STANDARD            1.091.295
    SORTED              3.159.771
    HASHED                994.101
    If for the STANDARD table you somehow destroy the hash administration (in this case it was done in the beginning by APPENDing one record):
    STANDARD            2.255.905
    SORTED                 14.013
    HASHED                  8.022
    (this 2nd execution was with less rows that the 1st execution, otherwise for the standard table it would take too long).
    So this does prove that standard tables can be faster than sorted tables in that special case, but again I would not rely on that.
    Rui Dantas

  • Sorting the values in a column in a Web Template Report

    Hi All,
    I have a report build on WAD in which a table is displayed with certain rows and columns and have certain text values in one column and few numeral values in the other few columns. When i right click on the 1st column(having text values) and click on Sort Ascending by Name, the values are sorted in groups.There are other 3 columns next to that column which have text values as well but when i right click on them and try to sort it in some order(ascending by name/descending by name), there are no reorganization of the values in the column. Again, once i go to the other remaining columns having numeral values in it, the values get sorted in ascending/descending order as per the sort selection. Please advise on how i can make the sort possible in the columns in which the rearrangement is not happening. Do i need to change the Query to some settings? Please advise.
    Thanks!
    Subhra Ghosh.

    Subhra,
    In BW reports, the sorting of characteristic values always happens left-to-right. When you choose to sort by columns 2 - 4, you are actually just specifying whether to sort ascending|descending and/or by key or text. This sort happens for each value of the first column, however. Therefore, the sort in column 2 is only noticeable when you have more than one row with the same value in column 1, etc.
    This sorting behavior is different than the Excel type of sorting, which may be your confusion here.
    If you want to sort first by a column other than column 1, you must swap the columns so that the desired characteristic is in column 1.
    Hope this helps...
    Bob

  • How to map single context value attribute to multiple value attributes?

    Hello,
    is there any way to map a single value attribute
    from view's context into several value attributes
    in controller's context?
    The business context of what I want to achieve
    is the following: I have a view which can be called
    in two modes: read only (RO) and read-write (RW).
    The input parameters to the view are the same for
    both modes, however when in RO mode, the view calls
    a different set of web services than when called
    in RW mode. Before calling each of the web services
    I need to populate their context value attributes
    with appropriate input values.
    I know I can do it in Java code, but is it possible
    to do it without any programming (doing it in the
    source code is prone to errors)?
    Any help highly appreciated.
    Greetings,
    Tomek.

    Hi Kishore,
    than you very much for your kind help.
    I have already created a value attribute of type
    boolean and mapped it into the read-only property
    of the UI elements. This however does not solve all
    of the problems... I will describe it with an
    example:
    Let's say the form I want to implement will be
    used to: create (read-write mode), update (read-
    write mode) or show (read-only mode) customer's
    data. The customer's data is complex (lots of
    data, including tree structures).
    The problem is that:
    - when the form is called in read-only mode,
      it should populate its fields with values
      provided by the getCustomerData web service,
    - when the form is called to create a new
      customer (in read-write) mode, it should
      not use the getCustomerData web service.
      Instead it should map the input values
      entered by the user into input parameters
      of the createNewCustomer web service,
    - when the form is called to update customer's
      data, it should first display values returned
      by the getCustomerData web service, and then
      it should map the modified values entered by
      the user into input parameters of the
      updateCustomer web service,
    In all the above cases I must map my view's
    context data to different controller's context
    elements. Doing it directly in the source code
    is not a nice solution. Is there any other
    way to achieve this? 
    Calling a form in different modes in not an
    unusual thing, so I was hoping that maybe
    there are any built-in mechanisms that would
    solve the obove problem...
    Greetings,
    Tomek.

  • Module pool / Screen Prog is there any standard SAP functionality ?

    Hi I am creating a Module pool / Screen Prog. On this screen I have nearly 100 fileds , now I want to take print out of all the information shown on the screen for the same is there any standard SAP functionality ?
    Does SAP provides any standarar ready made functionality for the same. ?

    No, there is no standard functionality for this.  dynpros are not designed to "print out".  This is what list displays are for.  That said, you will need to write your logic to kick off  a list display with all of your field values there,  then the user can print.
    Regards,
    Rich Heilman

  • Standard Mapping Templates for XML to Invoic02

    Hi Experts,
    I have been provided a customized XML from a partner which needs to be mapped to Invoic02 (Invoice Idoc).
    I wanted to know whether there are any standard mapping templates available for standard xml to invoice mapping (Example:
    XML standards are followed by xcbl).
    I have not been provided with the MIG.This will be helpful to me so that i can initially take up some of the field mappings.
    I have the following message which needs to be mapped to Invoic02 idoc :
    <?xml version="1.0" encoding="UTF-8" ?>
    <BlMessage>
    <TransactionInfo AcknowledgementRequested="false">
      <MessageSender>XXXX</MessageSender>
      <MessageRecipient>XXXX</MessageRecipient>
      <MessageID>XXX20090727_140928</MessageID>
      <Created>2009-08-18T14:09:28.450-07:00</Created>
      <FileName>XXX_310_20090727_140928560.xml</FileName>
      </TransactionInfo>
    <BL Sequence="1" Purpose="Original" BillType="SeaWaybill" CarrierScac="AAAA" ServiceType="NoCFS" MoveType="PortToPort" ShipmentId="22222" Payment="Collect" BLNumber="11111111">
    <References>
      <Reference referenceType="MutuallyDefined">20090406</Reference>
      </References>
    <Voyage>
    Thanks,
    Sudhansu

    I had to create an customized xsd.

  • Is there any standard function available for generation of RIN number.

    Hi experts,
    RIN is Renewable Identifiaction Number.
    Structure for a RIN is a 34-character numeric code in the format:
         YYYYCCCCFFFFFBBBBBRRDKSSSSSSEEEEEE
    YYYY  = Year of Batch Production (when it leaves the facility)
    CCCC = Company registration ID
    FFFFF = Facility registration ID
    BBBBB = Producer assigned Batch Number
    RR  = Equivalence Value for the renewable fuel
    D = Renewable Type Flag (1 - cellulosic; 2 - non-cellulosic)
    K = RIN Type Flag (1 - standard, 2 - extra-value)
    SSSSSS  = RIN Block Starting Gallon Number 
    EEEEEE  = RIN Block Ending Gallon Number 
    Is there any standard function avaiable in R3 to generate such number?
    Please reply asap.
    Thank you in advance.

    Hi deepak,
    1. we can use the FM
    DATE_CHECK_PLAUSIBILITY
    regards,
    amit m.

  • Product Delivered Status Date should be there in Standard Search and Result screen of Service Order. Product Delivered Time should be Available in Result screen and In Result screen there should be facility to filter on basis of Time

    Hi team,
    Product Delivered Status Date should be there in Standard Search and Result screen of Service Order. Product Delivered Time should be Available in Result screen and In Result screen there should be facility to filter on basis of Time.
    How to add this in search result screen.configuration is it possible? or any changes in development.
    Compnent - BT116S_SRVO
    Thanks
    Kalpana

    Hi Kalpana
    Please reread my comment. I said to try and populate "Requested End" Date.
    Make sure the date profile assigned to the transaction includes this Date Type.
    If you can populate this either manually or programmatically the solution should be quite forward.
    If you cannot do this, only then should you look at making any significant sort of enhancement.
    Regards
    Arden

  • Import manager error, when using Standard maps

    Hi,
    I am trying to import data using Import manager statndard Maps.
    For certain maps I am getting the following error message.
    <b>"Unable to retrieve unique values for field 'Key <Clone>'."</b>
    And also after getting this error if I close the current statndard map and open another standard map, import manager crashes.
    I am using MDM Version 5.5 SP2(5.5.24.04).
    Thanks
    Subbu

    Hi Subbu,
    I encountered this issue around inability around unique values for cloned fields too, although in custom maps, not standard ones.
    1.  When reported, this was fixed in 5.5.24.05.  So, try usin 5.5.24.06 and see if you still face it.
    2. The other option or workaround to be precise is to uncheck the Read-only box in bottom left hand corner of the second screen.  This should work too.
    As a last note, even in 5.5.24.06, I still encounter this issue when importing into nested look up tables. This is up for future fixes.
    I use the uncheck read-only as work around for now. 
    Good luck!
    Savi

Maybe you are looking for

  • Silent Installation of Oracle 10g on Windows XP

    Hi, I was trying out "SILENT INSTALLATION OF ORACLE 10g ON WINDOWS XP", where I was getting the following error. Can you please help me out. COMMAND GIVEN : D:\database>d:/disk1/setup.exe -responsefile d:/disk1/response/custom.rsp -silent -nowelcome

  • Ituneshelper was not installed correctly

    hi, when i try to open my itunes. it says ituneshelper was not installed correctly. i tried uninstalling it then reinstalling it but it still says the same thing. Help?

  • Transaction MM02 - Restriction for the clasification tab

    Hi, My client requirement is to restrict the users while accessing the transaction code MM02 for the classification tab. Under the classification tab users should not allow to make a new enter and delete the existing entry under class area and Charac

  • BT Infinity Cabling

    Hi I had BT Infinity installed a couple of days ago.  It was the engineer's last job on a Friday and he was running late, having arrived about 10 minutes before the end of his shift.  The installation involved running a 2-pair Cat 5 cable from the ma

  • Issues with modfication to Standard Web Template

    Hi all, I have created a copy(ZADHOC) of 0ADHOC standard template without any modifications. When I try to execute a query on the WEB with this template (ZADHOC) on Internet Explorer (Version 7 or 8), it gives me completely junk data (something in Ja