How to Sort JTable data using Multiple fields (Date, time and string)

I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
"1998/12/14","15:14:38","Unicorn1","row1"
"1998/12/14","15:14:39","Unicorn2","row2"
"1998/12/14","15:14:40","Unicorn4","row3"
"1998/12/17","12:14:12","Unicorn4","row6"
Now the Sorted Table should be in the following way:
"1998/12/17","12:14:12","Unicorn4","row6"
"1998/12/14","15:14:40","Unicorn4","row3"
"1998/12/14","15:14:39","Unicorn2","row2"
"1998/12/14","15:14:38","Unicorn1","row1"
ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
But now i need to sort on multiple columns.So what is code change in the Comparater class.
Thanks in advance.. This is urgent....

I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
  public void compareTo(Object obj)
    Schedule other = (Schedule)obj;
    return date.getTime() - other.getDate().getTime();
}

Similar Messages

  • [Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line

    Introduction
    Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands.
    Solution
    For character data fields, optional terminating characters allow you to mark the end of each field in a data file with a field terminator, as well as the end of each row with a row terminator. If a terminator character occurs within the data, it is interpreted
    as a terminator, not as data, and the data after that character is interpreted and belongs to the next field or record. I have done a test, if you use BULK INSERT or BCP commands and set the multiple field terminators, you can refer to the following command.
    In Windows command line,
    bcp <Databasename.schema.tablename> out “<path>” –c –t –r –T
    For example, you can export data from the Department table with bcp command and use the comma and colon (,:) as one field terminator.
    bcp AdventureWorks.HumanResources.Department out C:\myDepartment.txt -c -t ,: -r \n –T
    The txt file as follows:
    However, if you want to bcp by using multiple field terminators the same as the following command, which will still use the last terminator defined by default.
    bcp AdventureWorks.HumanResources.Department in C:\myDepartment.txt -c -t , -r \n -t: –T
    The txt file as follows:
    When multiple field terminators means multiple fields, you use the below comma separated format,
    column1,,column2,,,column3
    In this occasion, you only separate 3 fields (column1, column2 and column3). In fact, after testing, there will be 6 fields here. That is the significance of a field terminator (comma in this case).
    Meanwhile, using BULK INSERT to import the data of the data file into the SQL table, if you specify terminator for BULK import, you can only set multiple characters as one terminator in the BULK INSERT statement.
    USE <testdatabase>;
    GO
    BULK INSERT <your table> FROM ‘<Path>’
     WITH (
    DATAFILETYPE = ' char/native/ widechar /widenative',
     FIELDTERMINATOR = ' field_terminator',
    For example, using BULK INSERT to import the data of C:\myDepartment.txt data file into the DepartmentTest table, the field terminator (,:) must be declared in the statement.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,:’,
    The new table contains like as follows:  
    We could not declare multiple field terminators (, and :) in the Query statement,  as the following format, a duplicate error will occur.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,’,
    FIELDTERMINATOR = ‘:’
    However, if you want to use a data file with fewer or more fields, we can implement via setting extra field length to 0 for fewer fields or omitting or skipping more fields during the bulk copy procedure.  
    More Information
    For more information about filed terminators, you can review the following article.
    http://technet.microsoft.com/en-us/library/aa196735(v=sql.80).aspx
    http://social.technet.microsoft.com/Forums/en-US/d2fa4b1e-3bd4-4379-bc30-389202a99ae2/multiple-field-terminators-in-bulk-insert-or-bcp?forum=sqlgetsta
    http://technet.microsoft.com/en-us/library/ms191485.aspx
    http://technet.microsoft.com/en-us/library/aa173858(v=sql.80).aspx
    http://technet.microsoft.com/en-us/library/aa173842(v=sql.80).aspx
    Applies to
    SQL Server 2012
    SQL Server 2008R2
    SQL Server 2005
    SQL Server 2000
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Bind repeating data to multiple fields

    I am a livecycle numpty and I need some help! I am developing a readonly report. This report is using sample xml for databinding. Within the xml I have a repeating group - example:
    <group>
         <groupItem>
              <addres>parp</address>
         </groupItem>
          <groupItem>
              <addres>parp</address>
    In my report I have two sections that need to reference this repeating data. One section works and the other doesn't. I've read that you can't bind repeating data to multiple fields. How do I get around around this? I can't seem to get the global binding to work (is this purely for user entered data???)
    Please help!
    Cheers,
    Rich

    one way to do this is, in the Initialize event of the field in second repeating section, assign the rawValue from the first repeating section..
    For example..
    initialize event of Field2..
         Field2.rawValue = Field1.rawValue;
    Other way is to read the XML tags and assign the value to the fields..
    You need to loop thru the group element and read each group item value and assign the value to the field..
    Field2.rawValue = xfa.resolveNode("$record.group.groupItem").value; //this command will only read the first occurance of the groupItem value.
    Thanks
    Srini

  • How do know which services use up my data on my tablet? 2:How can I avoid this?

    How do know which services use up my data on my tablet? 2:How can I avoid this?

        @mwbail2,
    Great question! Managing your data usage is definitely important. You can view what apps are using data by going to Settings and then Mobile data on your phone. There is will show you the apps using data.
    If you want to avoid the data usage on the apps you want to make sure you close out the apps when not in use. You can also make sure that they are not automatically updating whenever there is a new update to the app. To do this simply go to the Play Store and select Menu. Then go to Settings and there you will see the option to change the auto update to update over wifi only.
    If you want to complete turn off data, just go to Settings and then mobile network and turn it off. Keep me posted if you need further assistance.
    JohnB_VZW
    Follow us on Twitter @VZWSupport

  • How to get  generic delta using timestamp field

    Hi All,
    i have created a generic datasource using tables vbrp,vbrk.mara,marc,knvv.. to get the sales data for planning.Here i have document created date and time.So i'm concatinating these 2 date and time fields into timestamp which is of format yyyymmddhhmmss.Finally i'm using this timestamp to extract data .
    So is it the right way to pull the data using timestamp and what is the timezone i need to specify as the servers are in india only.
    or any other way to proceed.
    Thanks
    Rao.

    Hi Rao,
    Delta based on timestamp based on generic datasource only works if any one of the tables contains timestamp field(not time and date fields separately).
    I dont think by combining date & time fields will give you correct results.
    Regarding time zone: Use SAP system time zone.
    Srini

  • I am using Windows 7 Home Premium 64-bit OS.  I've never had this problem before... today I opened iTunes and it prompted me to download the newest version.  I use iTunes all the time and have updated it multiple times with no issues.  During the installa

    I am using Windows 7 Home Premium 64-bit OS.I've never had this problem before... today I opened iTunes and it prompted me to download the newest version.  I use iTunes all the time and have updated it multiple times with no issues.  During the installation process it gave me an error message that said: 
    Runtime error! 
    Program C:\Program Files\iTunes.exe
    R0634
    An application has made an attempt to load the C runtime library incorrectly.
    Please contact the application's support team for more information.
    I quit the installation, uninstalled iTunes and rebooted my computer.  I now receive a similar message with a slight difference:
    Runtime error! 
    Program C:\Program Files (x86)...
    R0634
    An application has made an attempt to load the C runtime library incorrectly.
    Please contact the application's support team for more information.
    I did not leave anything out from the error message.  It doesn't point to a specific file, it just ends with "(x86)..."  Every time I boot up my computer, this error message pops up on my desktop.
    How do I repair this issue?  I have found multiple suggested solutions but am unsure which one is the best, and I don't want to try a bunch of different things for fear I may make the problem worse.  I would like to try and fix this myself if possible but I need to know if that is really possible or if I need to take my computer to someone for repairs.  Any suggestions will be greatly appreciated!!

    Hi lustyln,
    I'm having a little trouble understanding all of what you are trying to explain. From what I can tell, it sounds like your PC has a lot of software problems and you want to know what is supposed to be there and what isn't.
    For reference, here are your product specifications:
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&dlc=en&docname=c01893242&lc=en&product=4043282
    To get your PC software back to how it was when it was first purchased, run a system recovery:
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&dlc=en&docname=c01867418&lc=en&product=4043282
    I hope this helps.
    ...an HP employee just trying to help where I can, but not speaking on behalf of HP.

  • TS2972 how many IOS (iPads) can be used at the same time, and as a maximum, with home sharing?

    I would like to use multiple iPads at my residence and use home sharing for guests to watch content from my i-tunes, all on the the same network.
    what is the maximum number of IOS devices that can used at the same time, and be authorised on the "home sharing" at the same time?

    Thanks for a quick response!
    Under "Network adapters", here's what I found:
    - Broadcom 802.11g Network Adapter
    - 1394 Net Adapter
    - Marvell Yukon 88E8036 PCI-E Fast Ethernet Controler
    Two other wireless USB adapters are the same:
    - BLANC Mini Wireless USB adapter

  • How to verify my account using my yahoo email? and how to open my apple id in what mail in iphone 4?

    how to verify my account using my yahoo email? and how to open my apple id in what mail in iphone 4?

    Hi stanlaw,
    Welcome to the Support Communities!
    The information below should help you with this.
    Associating and verifying email addresses with your Apple ID
    http://support.apple.com/kb/HE68
    How to verify the primary email address for your Apple ID
    When you first create an Apple ID (using your email address) a verification email will be sent to that address. If you sign in to your Apple ID from the link in that email, the email address will be verified as the primary email address for your Apple ID. You can also resend the email verification if the email address is not verified:
    1. Sign in to My Apple ID to manage your account information.
    2. Click Resend under Primary Email Address.
    3. Verify your changes by following the link in the email you will receive from Apple and signing back in to your account.
    I hope this information helps ....
    Happy Holidays!
    - Judy

  • I dont know why the battery life of my iphone 4 is so low ! i really want to know how many hours i'll have if it's on standby. And how many hours if i use it normally for music and facebook (sometimes a little bit games)

    i dont know why the battery life of my iphone 4 is so low ! i really want to know how many hours i'll have if it's on standby. And how many hours if i use it normally for music and facebook (sometimes a little bit games) !!!

    to enhance your battery life, keep screen display to minimum, set screen lock automatically after 1 min, select internet notifications to off.

  • How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or

    The situation:
    I want to use basetext font, but some of the glyphs are missing in it, and are highlighted with pink boxes. common font [stix, etc.] have much more glyphs than basetext font. I can apply common font [stix, etc.]manually for each of the missing glyphs or insert two character and use kerning set it up, but it is tedious.
    Question:
    How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or insert two character and use kerning set it up?
    Any one know how to do this?
    Thanks in Advance,
    ~Jack

    Try Peter kehrl's script
    http://www.kahrel.plus.com/indesign/missing_glyphs.jsx

  • HT2470 how would i go about taking multiple files from documents and make them part of 1 master file

    how would i go about taking multiple files from documents and make them into 1 master file? I want to put all documents associated with this project together for easier access.

    From the finder window, click File, click new folder, you can drag all documents into that Folder making it the master folder. You can ajso drag folders into the Master folder, and have them as sub-folders if you wish to  do that. Either way they will all be in one master folder.

  • HT204406 how much storage is being used at a given time?

    How much storage is being used at a given time? And how do I look at and edit/delete the files that are being stored?

    Your ISP may be able to tell you that. The computer can't.

  • How can I set screen saver clock which show time and date when all screen is black. Other phones have this option but I didn't find on iphone. Pl guide.

    How can I set screen saver clock which show time and date when all screen is black. Other phones have this option but I didn't find on iphone. Pl guide.

    HA!  I figured the find my iphone out!!!!! You can have more than one icloud account in "Mail, Contacts and Calendars".  So my husband's & kids' phone icloud account under "settings, icloud "is their individual @me.com account.  Set it to everything you want EXCEPT Find My Iphone.  Then under "settings, mail/contacts/calendars" you set up both accounts (your @me.com which may already be there), then add another with the main appleID and enable ONLY Find My Iphone.  Now when any of us log into Find My Iphone from any device with our main apple ID for the app store, all the devices show up!!!! YIPPEE.  I made my own day!
    I think the message I got previously was because I hadn't disabled the find my iphone on the @me.com account first.

  • HT201412 My 4s is not picking up phone signal I do not no how to sort this out I have tried resetting it and its not working still I do receive messages and can send them but can not call as it just says call fail

    My 4s is not picking up phone signal I do not no how to sort this out I have tried resetting it and its not working still I do receive messages and can send them but can not call as it just says call fail

    Try resseting the network settings in settings>general then go to reset a the bottom.
    Then reset NETWORK settings.

  • No xauth data, using fake authentication data for X11 forwarding

    I'm trying to open an X Windows session via Reflection X (version 13.0.2) using secure shell to a Solaris 10 server. I'm asked for the host key authentication and my password but it then hangs. I get the following warning just before the reflectionX sessions hangs:-
    Warning: No xauth data, using fake authentication data for X11 forwarding.
    Does anyone have any clues to what may be wrong. If I use telnet via reflectionX the X Window works fine.

    I still get:
    Warning: No xauth data; using fake authentication data for X11 forwarding.
    Anyway I don't want to circumvent the problem but to solve it.

Maybe you are looking for