Sorting the TreeMap

I am trying to sort a TreeMap based on Values like this:-
public class SortedValueTest
public static void main( String[] args )
Map map = new TreeMap();
map.put( "field1", new Integer( 0 ) );
map.put( "field2", new Integer( 2 ) );
map.put( "field3", new Integer( 2 ) );
map.put( "field4", new Integer( 0 ) );
Set set = new TreeSet(
new Comparator()
public int compare( Object o1, Object o2 )
Map.Entry e1 = (Map.Entry)o1;
Map.Entry e2 = (Map.Entry)o2;
Integer d1 = (Integer)e1.getValue();
Integer d2 = (Integer)e2.getValue();
return d1.compareTo( d2 );
set.addAll( map.entrySet() );
for ( Iterator iter = set.iterator(); iter.hasNext(); )
Map.Entry entry = (Map.Entry)iter.next();
System.out.println( entry.getKey() + " = " + entry.getValue() );
The output obtained is like this:-
field1 = 0
field2 = 2
But the required output should not omit the duplicate items.
So the above solution based on TreeSet does not seems to be applicable.
Is there any alternative way to solve this problem?
Thanks in Advance.

SOLVED!!!
import java.io.IOException;
import java.util.*;
* Created by IntelliJ IDEA.
* User: ponmanadiyilv
* Date: 06-Mar-2006
* Time: 11:46:29
* To change this template use File | Settings | File Templates.
public class GoodSort {
public static void main(String[] args) throws Exception {
Map m = new HashMap();
m.put ("field1", new Integer(12));
m.put ("field2", new Integer(2));
m.put ("field3", new Integer(30));
m.put ("field4", new Integer(5555));
m.put ("field5", new Integer(0));
m.put ("field6", new Integer(5555));
ArrayList outputList = sortMap(m);
int count = 0;
count = outputList.size();
while(count > 0) {
Map.Entry entry = (Map.Entry) outputList.get(--count);
System.out.print("Key:" + entry.getKey());
System.out.println("\tValue:" + entry.getValue());
* This method will use Arrays.sort for sorting Map
* @param map
* @return outputList of Map.Entries
public static ArrayList sortMap(Map map) {
ArrayList outputList = null;
int count = 0;
Set set = null;
Map.Entry[] entries = null;
// Logic:
// get a set from Map
// Build a Map.Entry[] from set
// Sort the list using Arrays.sort
// Add the sorted Map.Entries into arrayList and return
set = (Set) map.entrySet();
Iterator iterator = set.iterator();
entries = new Map.Entry[set.size()];
while(iterator.hasNext()) {
entries[count++] = (Map.Entry) iterator.next();
// Sort the entries with your own comparator for the values:
Arrays.sort(entries, new Comparator() {
public int compareTo(Object lhs, Object rhs) {
Map.Entry le = (Map.Entry)lhs;
Map.Entry re = (Map.Entry)rhs;
return ((Comparable)le.getValue()).compareTo((Comparable)re.getValue());
public int compare(Object lhs, Object rhs) {
Map.Entry le = (Map.Entry)lhs;
Map.Entry re = (Map.Entry)rhs;
return ((Comparable)le.getValue()).compareTo((Comparable)re.getValue());
outputList = new ArrayList();
for(int i = 0; i < entries.length; i++) {
outputList.add(entries);
return outputList;
}//End of sortMap

Similar Messages

  • Sorting with TreeMap vs. quicksort

    I've been sorting lists by throwing them into a TreeMap then retrieving them in order (especially for fairly evenly distributed lists of strings), thereby leveraging its binary tree characteristics.
    My belief is that sorting this way takes N log N time, just as quicksort (as in Arrays.sort) does -- because adding items to a TreeMap takes log N time -- without any danger of stack overflows from recursing on a huge list as with quicksort, and fewer method calls which can get expensive.
    I'm figuring that even if this way of sorting uses more memory than an in-place sort as in Arrays.sort, at least it won't overflow the stack, and will mostly be eligible for garbage collection anyway.
    Could someone correct or confirm my conclusions, reasoning or assumptions? And how well do they apply to Collections.sort's merge sort?

    Using a tree guarentees worst case O(n log n) for n
    inserts.Amazing, my untrained intuition was correct.
    As for stack problems these are unlikely to occur until
    logn is at least a few thousand (think about stupidly large values of
    n).I regularly need to sort lists of tends of thousands of strings.
    .. its [quicksort's] gotcha is that
    performance can degrade well below this approaching
    O(n^2) (might be higher. I cant remember).Yes, O(n^2) for adversarial data. Does mergesort require a shallower recursion than quicksort does?
    Since temporary use of the heap is rarely a concern for me, and datasets are very large, it sounds like mergesort and the TreeMap are viable contenders for preferred sorting methods. But I'm still apprehensive about mergesort's use of recursion.
    Thank you, I gave you 5 duke dollars and matei 2.

  • Custom Sorting in TreeMap.

    Can I sort the contents of TreeMap according to values.
    As default TreeMap is sorted according to Keys. But I want to sort it according to values. Can I met this using comparator?
    Thanks in advance for your help.

    no, you cannot. besides sorting, the comparator is used by the treemap to locate keys/values given an arbitrary key. if you sorted the map based on the values, you would never be able to find anything in it by key.

  • Sort a treemap/hashmap by values

    I'm writing a really simple program that creates a treemap and writes it line by line to a text file. I want it to be ordered by the values asociated with the keys, not by the keys themselves.
    The map simply has strings for keys, the value with each one is the number of times that string appears in the input text file.
    I've looked at the constructor treemap(Comparator c), but didn't really see how I could use it. Is there a simple way to get the text file sorted by values, not the keys?
    Thanks!

    Do you really need a SortedMap to do this? Is there any point when you really need the data sorted by the String keys?
    Probably easier, once you have the collection of String/frequency pairs, just to dump that into a List and sort the List using a comparator that looks at the frequency primarily.

  • Can not sort the files in JFileChooser if the files are from remote machine

    Hi All,
    Let me set the context of the question.
    I have extended the JFileChooser to support the listing/view of files.dirs etc of remote location through CORBA.To achieve that i have customized
    my FileSystemView to support it. In general ,the current JFileChooser sorts the file when we have details view .My question is related to this.The default
    JFileChooser has the support for sorting but when i customized the FileSystemView,the sorting functionality is no more exist.I tried with TableRowSorter as well but
    the sorting can be achieved in View only,the model still remains same as initial.
    Any pointer towards this will be highly appreciated.
    Thanks
    Praveen

    Can anyone help me out to solve this problem or any suggestion regarding this ?
    Regards
    Praveen

  • Open a SharePoint List item in Modal Pop up in SP 2013 fails after you filter or sort the list

    Sorry for the long post. This has been killing me. I had this script working perfectly fine in SharePoint 2010 (online) and basically i have a source custom list (list A) with a hyperlink column and a Destination List with say title and my name.
    Source List (list A) looks like this with these 2 columns
    Title    Test Link
    A         Link 1
    B         Link 2 
    C         Link 3
    Each of these links link to the actual list item in the destination list, so for example, link 1 is/sites/2013DevSite/Lists/Destination%20List/EditForm.aspx?ID=1
    So basically i want anytime the Link are clicked that point to another list's item to open in a modal dialog and the script below worked perfectly fine in SharePoint 2010 (online)
    <script language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
    <script language ="javascript" type="text/javascript">   
    jQuery(document).ready(function() {
    jQuery('a[href*="EditForm.aspx"]').each(function (i, e) {
    // Store the A tag's current href in a variable
    var currentHref = jQuery(e).attr('href');
    jQuery(e).attr({
    'href': 'javascript:void(0);', 
    // Use the stored href as argument for the ShowInModal functions parameter.
    'onclick': 'ShowInModal("' + currentHref + '");'
    function ShowInModal(href) {
    SP.UI.ModalDialog.showModalDialog({title: "Edit Item", url: href});    
    </script>
    All it does is find the href tags for that particular value Editform.aspx and the pop modal works in SP 2010 online. So the site page is designed in such a way there is a content editor web part with the reference to this javascript file and the sharepoint
    list is right beneath it and this worked perfectly opening in modal windows in SP 2010.
    Since migration to 2013, this is what exactly happens
    1.) when you come to the site page, the modal works,
    2.) If you filter or sort on say the Title or Test Link column in Source list (lets say you select the Value A), the script does not fire at all, if i hover over the hyperlink, the who hyperlink is shown and does not open the hyperlink in the modal pop up.
    - This is important because i want to be able to sort on a particular item...
    Could someone please let me know what am i doing wrong and why is this not working when i sort the list. Thanks for all the help.
    Once again i am trying to open a sharepoint list item in Sharepoint 2013 from another list using Jquery

    A ListItem has its own unique row id so in all likelihood, an insert with the same data will result in a new list entry. The Lists Web Service however, has an UpdateListItem method which will take an update request. [refer
    http://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.15).aspx ]
    There is another note in the conference (marked answered) to your List Item Update problem. Probably worth a try too. [refer
    http://social.msdn.microsoft.com/Forums/en-US/bee8f6c6-3259-4764-bafa-6689f5fd6ec9/how-to-update-an-existing-item-in-a-sharepoint-list-using-the-wss-adapter-for-biztalk?forum=biztalkgeneral ]
    Regards.

  • ALV: Issue with double  click event after sorting the ALV

    Hello Experts,
    I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
    My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
    When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
    There is one more paramter in HANDLE_DOUBLE_CLICK for row id.   It is coming blank in debugging .  what is the purpose of this parameter and how i can make use of it ?
    Regards
    Vivek

    Hi,
    I am Posting The Code Which Uses Double Click Event.
    And This Code will provide the total information to you.
    REPORT  ZALVGRID_PG.
    TABLES: SSCRFIELDS.
    DATA: V_BELNR TYPE RBKP-BELNR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: IRNO FOR V_BELNR.
    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA: WA TYPE ZALVGRID_DISPLAY,
          ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
    TYPE-POOLS: SLIS,SDYDO.
    DATA: L_LOGO TYPE SDYDO_VALUE,
          L_LIST TYPE SLIS_T_LISTHEADER.
    END-OF-SELECTION.
    CLASS CL_LC DEFINITION.
      PUBLIC SECTION.
        METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS CL_LC IMPLEMENTATION.
      METHOD DC.
        DATA: WA1 TYPE ZALVGRID_DISPLAY.
        READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
        BREAK-POINT.
        SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
        CALL TRANSACTION 'FB02'.
      ENDMETHOD.                    "DC
    ENDCLASS.
    DATA: OBJ_CL TYPE REF TO CL_LC.
    START-OF-SELECTION.
      PERFORM SELECT_DATA.
      IF SY-SUBRC = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE E000(0) WITH 'DATA NOT FOUND'.
      ENDIF.
      INCLUDE ZALVGRID_PG_STATUS_0100O01.
      INCLUDE ZALVGRID_PG_LOGOSUBF01.
      INCLUDE ZALVGRID_PG_SELECT_DATAF01.
    INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
    ***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'AB'.
    *  SET TITLEBAR 'xxx'.
      IF IDENTITY IS INITIAL.
        CREATE OBJECT IDENTITY
        EXPORTING
          CONTAINER_NAME = 'ALVCONTROL'.
        CREATE OBJECT GRID
        EXPORTING
          I_PARENT = IDENTITY.
        CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
             I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
          CHANGING
            IT_OUTTAB                     = ITAB.
        CREATE OBJECT OBJ_CL.
        SET HANDLER OBJ_CL->DC FOR GRID.
        ENDIF.
        IF L_IDENTITY IS INITIAL.
          CREATE OBJECT L_IDENTITY
          EXPORTING
            CONTAINER_NAME = 'LOGO'.
          CREATE OBJECT L_TREE
          EXPORTING
            I_PARENT = L_IDENTITY.
          PERFORM LOGOSUB USING L_LOGO.
          CALL METHOD L_TREE->CREATE_REPORT_HEADER
            EXPORTING
              IT_LIST_COMMENTARY    = L_LIST
              I_LOGO                = L_LOGO.
          ENDIF    .
    ENDMODULE.                 " STATUS_0100  OUTPUT
    ***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
    FORM LOGOSUB  USING    P_L_LOGO.
      P_L_LOGO = 'ERPLOGO'.
    ENDFORM.                    " LOGOSUB
    ***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
    FORM SELECT_DATA .
      SELECT RBKP~BELNR
             RBKP~BLDAT
             RSEG~BUZEI
             RSEG~MATNR
             INTO TABLE ITAB
             FROM RBKP INNER JOIN RSEG
        ON RBKP~BELNR = RSEG~BELNR
        WHERE RBKP~BELNR IN IRNO
        AND RBKP~GJAHR = P_GJAHR.
    ENDFORM.                    " SELECT_DATA
    ***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
           EXIT.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Warm Regards,
    PavanKumar.G
    Edited by: pavankumar.g on Jan 19, 2012 5:30 AM

  • I have downloaded and installed the latest version of numbers on my mac. Everytime I save and then try to reopen that document, I receive a message telling me that I need a new version of numbers. Also, when I try to sort the date column, it sorts out of

    I have downloaded and installed the latest version of numbers on my mac. Everytime I save and then try to reopen that document, I receive a message telling me that I need a new version of numbers. Also, when I try to sort the date column, it sorts out of order. The last version sorted fine.

    Welcome to Apple Support Communities
    When you install the new iWork version, the old iWork version is kept, so it looks like you are opening your old version.
    To fix this, open a Finder window, choose Applications in the sidebar and drag the new Numbers version to the Dock, so you can access to it quickly. Open all documents from this version. I don't recommend you to delete the old Numbers version in case you need it.
    Respecting to the second question, you will get better answers in the Numbers for OS X forum

  • Sorting the report by clicking the column header

    Hello,
    Currently working on a requirement where i need to sort the report by clicking the column header. Can anyone please help me on this.
    Suppose i have 3 colums deptno,dname,sal fields in my report. if i click deptno column header,  report has to sort by deptno.Like that i need for other columns also.
    Any help is really appreciated
    Thanks
    Ram

    Hello,
    You can sort the fields using method suggested by Cauvery. However if you would like to have Ascending/ Descending sort order control at column header, then would require to implement few additional steps.
    First do the sorting of field using the way suggested by Cauvery. Once sorting is done, right  click on the column name and  select the option ' Bind Sort Control'. You will see the sorted field in the window. select the field and click ok.
    Now you would get 2 arrows on column. If you click upper arrow, fields would be sorted in Ascending Order and if you click on down arrow, it would  be in Descending order.
    Regards,
    Chinmay Athavale

  • Help, how do I get iPad Photos to sort the way I want?

    I'm at wits end!
    After a week of constant sync/re-sync/re-name-stripping out all EXIF data, I'm still at the mercy of some random sort order for some of my photos.
    I have read: http://support.apple.com/kb/HT4221 - which seems to indicate that it reads the EXIF data first. I have stripped all EXIF data from all my photos in hopes that it will resort to alphabetical order of the file-names. But it doesn't seem to do so - it seems to still rely on last modified date of the file itself. Short of copying individually hundreds of photos over in the order that I want - I don't know what to do. Additionally, through trial and error, it seems that it doesn't recognize differences in timestamp in the seconds, only minutes - ARGH!! Is anyone else having such a hard time to get the iPad to sort the photos by filename in an order that I specify?
    I am not on Mac and cannot use iPhoto to sort, so I am on the PC side and order my photos using ACDSee and batch rename them so that they are alphabetically correct.
    Please, its essential that they are grouped in my order, but I can't for the last week coax my iPad to display in alphabetical filename order (it seems simple enough?!) I'm so frustrated!!
    Please help.

    I do not understand what you mean by a problem with downsizing large image, the images I have dragged over are exactly the same size as on my home computer, I can see it may cause the IPad problems if you are trying to transfer 50 mb tiff files or something similar, it really is not designed for that type of image.
    My workflow is as follows, I work up my raw files and save a copy as a tiff for printed output, for web or iPad use I make an approx 2 Mb jpeg file.
    I make a folder with an appropriate title, insert the required images, the images are sorted either by the original camera file numbering or if I want items in a particular order I will start a number 1 and continue, Airsharing will respect your ordering sequence, so number 1 will always be number 1.
    As a viewer Air Sharing in my opinion is better than the photo app because it leaves your images in the order you have set, to view an image you open the folder click on number 1 or whatever is your 1st image, that
    opens full screen, you have the choice of moving through the folder singly by clicking the arrow head at the bottom right/left of the screen or a slide show by clicking the centre arrow head, you set the time on screen etc.
    If you put the same selection of images on the iPad via the Photo app it would number your images in a way you have little control over and will even optimise your image even if you do not want it to !
    The Airsharing library is seperate from the photo library, you can move images to the photo library but why would you want to do that ? All your image sorting is done on your computer prior to the transfer, surely you do not want an app making decisions on you behalf ?
    To me it is a perfect portfolio app because I make all the decisions about file size, sequence of images how I want to display them, singly or as a slideshow I am in control not Apple.

  • How to sort the messages in Browser Console by time

    In the Browser Console the messages are sometimes out of order. This can be confusing when debugging an application. Is there an easy way to sort the messages by the timestamps?
    See also: https://bugzilla.mozilla.org/show_bug.cgi?id=854435.
    It seems this has been the case for some time. I am seeing it in version 26.0. I can copy the messages to a spreadsheet and sort them there, but that's a bit tedious.

    Thanks cor-el. I notice this in the interleaving of Net and Logging messages. I haven't yet noticed a case where Net or Logging messages alone are out of order. Separate threads with different latency to posting messages makes sense.
    From my perspective, hiding the timestamps isn't a solution. It obscures the problem rather than fixing it. I noticed the problem before I looked at the timestamps carefully. When I'm debugging, the order of events is sometimes essential to a correct understanding of what is happening. So, I hope that in addition to giving people the option to hide the timestamps, an option to sort the messages by timestamp will be added. If it were my choice, sorted by timestamp would be the default.

  • How to sort the members by alias names

    I am trying to create dimension build rule whicl will sort the dimension members in an ascending order, but it has to be based on the alias name instead of the member name.
    I have tried both Parent-CHild and Generation reference but it doesn't work.
    For example
    for the city members PSE ( alias name Purchase), and USALB ( alias Albany) needs to be sorted by alias names
    the current order is
    PSE(Purchase)
    USALB(albany)
    but the requirement is to be
    USALB( Albany)
    PSE(Purchase)

    Even with presorting the input, you still have work to do. By default, Essbase will add new members to the bottom of the list of membrers, it does not insert them into an existing hierarchy in the right places. If your trying to update existing hierarchies and are going the SQL route, you will need two rules (or 1 rule and a flat file). You also need to specify remove unspecified as part of the dimension build process.
    HAve a dummy input (either sql or file) that gets loaded the first time. IT will basically wipe out all the members of the dimension, then your second rule (or same rule calling your SQL) can reload the dimension sorted in alias order.
    IT is important that these two rules be done together (either in MaxL using comasin a single statement) or in a BSO cube in the outline before the outline is saved. Otherwise you will have deleted any data that existed in the database. It would be impartant that your SQL also pulls all members (including any special members)
    Edited by: GlennS_2 on Jan 6, 2010 9:48 AM
    You say you are going to change the stored procedure. That is not necessary, you could put an order by clause in your sql extract statement

  • How can I sort the words in a document into an alphabetical list?

    How can I sort the words in a document into an alphabetical list? Thanks!

    writer888 wrote:
    How can I sort the words in a document into an alphabetical list? Thanks!
    Copy the words to the Mac's clipboard (Edit menu> Copy)
    Paste into TextEdit 
    Next open the Edit > Find > Find window in Text Edit.
    Highlight a space between two words and Edit menu > copy, paste into the Find field
    Next create a return in the middle of your text and copy that and paste into the Replace field
    Click Replace All.
    Now Edit > Select All and Edit > Copy
    Open a Spreadsheet program with Sort ability and paste into the second column cell from the top
    place a "a" into the top column cell, select the entire colum
    Sort desending order
    Now if you need it out of spreadsheet format, then your going to need to copy just the data cells (not the entire column to avoid problems) and Paste "Special" as unformatted text into a word processing program
    If you need to get rid of the Returns, do the opposite you did in Text Edit, replace the Returns with Spaces
    A chore, but it's rare one needs to sort words into alaphabetical order.
    FYI, I used TextEdit and the free LibreOffice (Spreadsheet and Word Processing) for the above effects.

  • Why am I unable to sort the music on my iPhone 4S when viewing it in iTunes?

    Hello,
    Apologies if this has been answered already; I searched for it but none of the results appeared relevent to my issue.
    I have an ipod touch 4th generation, which I manually manage from the the iTunes library on my home PC (Windows 7, 32bit). I am able to plug the ipod touch into my work laptop, to listen to the music on it through iTunes. I can see the list of songs on my ipod via the 'Music' tab of the 'Devices' section in iTunes. In that view, I am also able to sort the list as I see fit, by clicking on the various column headings to change the order of that column appropriately.
    I have recently purchased an iPhone 4S, and loaded it with music from my own computer's iTunes library in the same way I did for my ipod. However, when viewing the songs on my 4S on my work laptop in the same way as above, I am unable to sort the view at all. Why is this?
    It's annoying not being able to sort the songs in an order different to how they were sorted on the parent machine. For example, if I'm looking in my song list for a song I added recently, I was able to find them on my ipod by simply ordering the list by Date Added or Date Modified, but there seems to be no way of doing this for the 4S?
    Thanks in advance.

    Thanks for your message.
    I have downloaded the latest iTunes [11.1.5 (5)] with no luck, unfortunately. As it did with 11.1.4 (62), iTunes recognizes my iPhone, I can select the music to sync, click sync, it appears to sync but remains completely unchanged in my iPhone music.
    Any tips are welcome!

  • How to sort  the arry value in ascending order

    I have a string array where i need to sort the below values in ascending order in the same format...can anyone give me clue on this?
    9.3
    3.1
    9.1
    19.1
    19
    9.4
    9.1.1
    the sorted order should be
    3.1
    9.1
    9.1.1
    9.3
    9.4
    19
    19.1

    You may have easier luck writing your own comparator for this. These are headings in a table of contents, right?
    Write a comparator that tokenizes a string on the '.' character, or use a StringBuffer to remove them, and then order the elements according to the combined numbers. Since alphanumeric would order this list as you want it anyway you could just order that way once the '.' are removed.
    In other words your comparator would do this in the "compare" method:
    public class MyComparator implements Comparator, java.io.Serializable {
    private static Comparator stringComparator = java.text.Collator.getInstance();
    ...constructor(s), your own private "instance" variable of type MyComparator, a getInstance() method of your own, yadda yadda...
    public int compare(Object item1, Object item2) {
    try {
    value1 = removePeriods((String)item1);
    value2 = removePeriods((String)item2);
    if (value1 == null) {
    return (value2 == null) ? 0 : (-1);
    return compare(value1, value2);
    } catch (ClassCastException cce) {
    System.err.println("Wrong Object Type, JackAss!");
    protected int compare(String str1, String str2) {
    return MyComparator.stringComparator.compare(str1, str2);
    private String removePeriods(String value) {
    StringBuffer sb = new StringBuffer(value);
    int decimalIndex = value.indexOf('.');
    while (decimalIndex != -1) {
    sb.delete(decimalIndex, (decimalIndex + 1));
    }

Maybe you are looking for

  • T400 and the Mat**bleep​**a DVA-RAM UJ862A

    I  purchased a LENOVO T400 on 12/01/08. I downgraded it too XP -SP3. Everything works fine, but I found there is a serial Mat**bleep**a DVA-RAM UJ862A  slim installed. This Drive doesn't work fine for me. It is a known issues with the restriction on

  • Any program other than safari won't detect internet

    any program other than safari won't detect internet eg. itunes, skype etc. I can't even system update. Safari has no problems and I can use the internet fine. Someone told me to check proxy settings and make sure "Use Passive FTP Mode" was ticked whi

  • Dimensional reporting in OBIEE.

    One of our customer has encountered an Sev 1 issue related to running out of Temp table space . They are trying to create a report which has attributes from 3 different dimension, without any fact attribute or metric in it and the results never come

  • Unix Command to Shutdown

    What is the most basic way to shutdown via the command line? Thanks. Steve M.

  • Template Deployment error 26558

    Hello, I know there's certain problems with Gen2 VMs and templates, but I also cannot deploy templates from Gen1 machines. When I do so, it ends up in error 26558 stating: VMM could not apply the access control entries on share NO_PARAM. This is need