Best way to sort data from a file alphabetically

If I have a file as such:
FIRST_NAME|LAST_NAME
I want to display the data in alphabetical order by last name and by first name. what is the best way to do this? I found java.util.Arrays
but i thought that it might be best if i read the data into a linked list. I want to display it on a form, so that I can press a next and previous button. Next will show the next record in alphabetical order after the previous one(B->C) and previous would go (C->B)
thanks.

How about this:
Create a PersonRecord object, and have it implement Comparable.
import java.util.Comparator;
public class PersonRecord implements Comparable < PersonRecord >
    public static Comparator < PersonRecord > surnameComparator ()
        public int compare (PersonRecord pr1, PersonRecord pr2)
            return pr1.getSurname ().compareTo (pr2.getSurname ());
    public static Comparator < PersonRecord > nameComparator ()
        public int compare (PersonRecord pr1, PersonRecord pr2)
            return pr1.getName ().compareTo (pr2.getName ());
}See java.util.Comparator, java.lang.Comparable.
Then use Arrays.sort(List, Comparable) at your own discretion...
I've said enough; work that part out yourself.
lutha

Similar Messages

  • How is the best way to read data from an iphone if you lost your itunes data after a crash?

    How is the best way to read data from an iphone if you lost your itunes data after a crash?

    How is the best way to read data from an iphone if you lost your itunes data after a crash?

  • What could be the best way to Export data from 11.5.8 instance to 12.1.2?

    Hi All
    What could be the best way to Export data from 11.5.8 instance to 12.1.2?
    Release: 11.5.8
    OS: Oracle Solaris on SPARC (32-bit) verison 9
    DB: 9.2.0.1
    Thanks in advance

    What kind of data you are looking to move?
    Database export/import is only supported for full database export/import and the application release should be the same on the source/target nodes.
    You can move the setup using iSetup or FNDLOAD.
    Thanks,
    Hussein

  • What is the best way to transfer data from a PC to an iMac?

    What is the best way to transfer data from a PC to an iMac?

    If you know how to set up a computer-to-computer Ethernet network, then you can give that a try, but a hard drive will be faster than Ethernet unless you don't have a lot to transfer.
    Mac OS X 10.6 Help- Creating a computer-to-computer network

  • Best way to extract data from archived cube

    Hello Experts,
    Can anyone tell me best way to extract data from archived cube.
    Basically I am trying to pull all the data from archived cube and then load it into another brand new infoprovider which is in different box.
    Also I need to extract all the master data for all infoobjects.
    I have two options in my mind:
    1) Use open hub destination
    or
    2) Infoprovider>display data>select the fields and download the data.
    Is it really possible to extract data using option (2) if records are too high and then load it into another infoprovider in new system.
    Please suggest me the pros and cons for the two options.
    Thanks for your time in advance.

    Hello Reddy,
    Thanks a lot for your quick reply.
    Actually in my case I am trying to extract archived infocube data and then load it into new infoprovider which is in different system. If I have connectivity I can simply export data source from archived infocube and then reload into new infoprovider.
    But there is no connectivity between those two systems (where archived cube is and new infoprovider) and so I am left with the two options I mentioned.
    1) Use Open Hub
    or
    2) Extract data manually from infoprovider into excel.
    Can anyone let me know which of the two options is the best and also I doubt on how to use excel in extracting data as excel have limit of no.of records 65536
    Thanks
    Edited by: saptrain on Mar 12, 2010 6:13 AM

  • What is the best way to save data from GPIB Device in a file?

    HI!
    I have a Keithley SourceMeter and want to save readings in a File along with settings on the front panel and timestamps plus several other infos. What is the best way to do this? Which file type? Any recommendations or hints could help me?
    Thanks

    Hi Andy,
    There are 3 main file formats that you can consider writing your data out to in LabVIEW:
    ASCII
    Binary
    Datalog
    ASCII
    ASCII files are useful because every operating system and almost every application can read/write ASCII format files. Use ASCII files when:
    Other users or applications will need to access the data file.
    You will not need to perform random access file I/O
    File I/O speed is not crucial
    Disk space is not crucial
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write to Text File.vi and Read from Text File.vi
    Binary
    Binary byte stream files are more specific to data storage and retrieval. Use b
    inary files when:
    File I/O will remain in LabVIEW only -- no other applications will be needing to write/read that file. There is no standard formatting for binary files and thus other applications or operating systems may be unable to read the file.
    Files are smaller than ASCII files
    Easier and faster random access to data
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Binary File.vi and Read Binary File.vi
    Datalog
    When to use datalog:
    If you need to record data with a mixture of types, it can be cumbersome to convert everything to ASCII or to keep track of the binary formatting.
    Datalog format is binary and internal to LabVIEW, so again only use this format if no other applications or operating systems will be needing to perform file I/O on the file.
    Examples within LabVIEW Example Finder: Fundamentals >> File Input and Output >> Write Datalog File
    Example.vi and Read Datalog File Example.vi
    Good luck!
    Kileen C.
    Applications Engineer
    National Instruments

  • Best way to transfer data from other computer

    I'm wondering what is the fastest, or most reliable way to transfer data from another computer to my G5. I've skimmed through manual for G5 and it seems to list several options, if I'm understanding it correctly.
    1. Using Airport Extreme
    2. Using Bluetooth
    3. Hooking up a local Ethernet connection
    4. Setting up a Firewall connection?
    I want to be able to transfer a completed iDVD project created on an iMac G3 to my G5 for burning the DVD. And which method (if any) will work with a non-Mac computer?
    Anyone know the advantages, disadvantages of the transfer methods?
    ccCarol

    If you have a high-speed connection, another easy & fast way to transfer files between computers is through AIM (AOL Instant Messenger).
    iChat has the same ability of transferring large files as AIM.
    http://docs.info.apple.com/article.html?artnum=150934

  • Best way to move data from table to a file

    Hi,
       I have a two tables in ecc, And I need to read the data and copy to a file and ftp to another server.
    One table is really huge. What is the best approch to move this data using PI. I can not avoid PI, since it needs some mapping.
    1. Proxy-PI-FTP
    2. Dump the data to a file and use FTP_PI_FTP
    3. Any other.
    Thank you
    Moni

    it is really a project decision but I can give you some pro's and con's.
    Proxy --> File
    You cab communicate directly with the XI pipeline which means you don't have to go through the adapter engine.
    RFC --> File
    This is very standard SAP and most ABAP programmers will be able to utilize this.
    IDoc --> File
    Standard SAP ALE technology but can get very big due to useless segments
    Dump File
    The biggest positive of this is the fact that you wouldn't have to convert to XML which will ensure that the message doesn't grow in size as is the case with all of the above.
    This is very brief but should give you a good idea....

  • Best way to store data from a plot on hard drive

    I have a DAQ set-up that will be on 24/7 for several days, and the whole time it's streaming data to an XY-Graph with a limited buffer.  My question is, what's the best way to store my plot data in such a way that I can empty out my plot every few hours but if I want to pull up data from a few hours ago I would just have an option on my initial VI to view any old saved plot data.
    Basically, I'm trying to not overload my RAM with all my plot data so I'd like to save it to the hard drive while my VI is running, and only display, for example the last 8 hours worth of data... I've been looking at TDMS, but I'm not sure if that's the right solution.  
    much thanks!

    Hi,
    You could save your data using TDMS as well as ASCII to simply load it in another application later.
    Attached VI shows you how to save your data to a File after a certain amount of iterations, you can combine this then with your code and a timestamp.
    Christian
    Attachments:
    Save to new file every N samples.vi ‏20 KB

  • Best way to collect data from a PDF?

    What is the best way to collect 3 pieces of data that can be exported to Excel from a PDF that was created from a webpage?
    I thought about using a form, but I would need the form to stay with the PDF. Is it possible to attach a form that would open side by side with my PDF where I can type the data, then somehow export the data into Excel?
    Is it better to use insert comments, which looks like they can be exported as well?
    Many thanks.

    Hi,
    You could save your data using TDMS as well as ASCII to simply load it in another application later.
    Attached VI shows you how to save your data to a File after a certain amount of iterations, you can combine this then with your code and a timestamp.
    Christian
    Attachments:
    Save to new file every N samples.vi ‏20 KB

  • Best way to recieve Datas from MII in SAP

    Hi everybody,
    We are discussing which way is the best to get data to SAP when SAP is the initiator.
    We tesed RFC but it looks like that if I call a transaction in MII as a rfc I can only send data and it is not possible to recieve data in this way. Can somebody confirm that?
    To send data to MII we usually use IDOCs when SAP is the initiator.
    To send data to SAP we usually use rfc when MII is the initiator.
    To send data to MIIwe usually use rfc when MII is the initiator
    But what can we use if we want to send data to SAP and SAP is the initiator?
    Thanks for your help.
    Regards,
    Matthias

    Hi,
    thanks for your quick answer.
    Is it possible to use an rfc in ABAP-Code and recieve data?
    I think this is not possible.
    Our Business-case:
    A user starts an SAP-Programm (e.g. custom transaction) where he has some informations to a machine.
    In this program we also want to see data from MII.
    it should be something like this in ABAP-code:
    CALL FUNCTION mii_transaction DESTINATION mii_dest
                         parameter_list.
    But I read in a help-file that it is only possible to send information not to recieve. Is this correct?
    Or is it also possible to recieve data from mii like this (in parameter_list)?
    Regards,
    Matthias

  • Best way to sync data from temp database back to primary one?

    Hello all!!
    I'm trying to figure the best way to remedy this situation.
    I have a RAC cluster...and one instance went down...some problems with all nodes running, etc. Anyway, while working with Oracle support, I was able to get one node up with sqlplus, and I ran a datapump export, and move that file to a test server I have...as that this was the quickest solution, and I was able to get my developers up and running again on the new server.
    I've been working with Oracle support for weeks now...and now all instances on the main RAC cluster all seem to be up and running now.
    The trouble is...the instance that was 'moved' to the test server...has had a LOT of work on it in many of the schemas it contains. I need to move the developers back to the main unit where backups are taken and more horsepower for load testing, etc.
    What is the best way for me to sync the main server up with the changes made in these weeks on the test server.
    Would it be best to take a datapump export from the test box.....move it over to the main server, and basically then....truncate all non-system schemas and just import from the test server (with changes) back onto the main server?
    Any other suggestions?
    Thank you in advance,
    cayenne
    ps. Both main and test servers are same version of Oracle 11Gr2 RAC. No rman backups currently being taken on test server, not in archive log mode on test server.

    The trouble is...the instance that was 'moved' to the test server...has had a LOT of work on it in many of the schemas it contains. I need to move the developers back to the main unit where backups are taken and more horsepower for load testing, etc.What is the nature of the work? Cleaned and filtered data? New code/stored procedures/triggers/metadata?

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

  • Best way to move data from page to page inside app

    Hi all I started writing this and it got way to complicated to explain in full without a novel.
    Breif description. I am using query string that starts in the parent window (from href in json file) it then has to be moved into the iframe url when moving to other pages to avoid security as page and iframe are conflicting http and https. and cannot be accessed.. it seems there must be a better way.
    So my question is what is the best way in open platform to move data from one page to another?

    Hi Liam
    Small data just a webapp ID and I am using the URL. But if you pass a ID say from Json ie "href":"/Admin/AppLoader.aspx?client_id=dev-name&ID=111111" it gets passed to the page url. This can be referenced using document.referrer initially. As the app is inside another frame and url that is https there is security issue using parent.location between https and http. Fine but then if you move to a new page referrer is no longer as there is no real referrer and you have to use location but you cannot. Now the work around is to pass the value from the page url to the app url at the start. and then you get around http https security issue when using parent.location but this seems convoluted and like a work around. Is this really the only way or the best way or a bad way. without using other ways that seem over kill for 6 odd characters.

  • The best way to extract data from MySQL

    I have a MySQL db that contains information about whether respondents are coming to an airshow, what days they plan to attend and how will they travel (www.hollisterairshow.com/helpusplan.php . I can export data from this to a spreadsheet as the summary info will only be seen by the organizers but ideally I'd like to create a page that will summarize responses. Something like this:
    Saturday
    Autos: xxxxx Occupants: yyyyyy
    Aircraft: xxxxx Occupants: yyyyyy
    Other: xxxxx Occupants: yyyyyy
    Sunday
    Autos: xxxxx Occupants: yyyyy
    Aircraft: xxxxx Occupants: yyyyy
    Other: xxxxx Occupants: yyyyy
    Camping: xxxxx Occupants: yyyyy
    How did you hear about the Airshow:
    Radio: xxx TV: xxx Newspaper: xxx Magazine: xxx Internet: xxx Other: xxx 
    I thought I would create a couple of recordsets, one for respondents who will attend on Saturday and the other for respondents who will attend on Sunday then all I'd need to do is count the number of respondents and sum the number of occupants for each recordset, and count/ sum campers for the whole file and similarly for the "how did you hear about it" question. Is this the best way or am I missing a more elegant solution?
    Thanks,
    Tony 

    The page I'm trying to create is here www.hollisterairshow.com/plan-results.php and the questionnaire is here www.hollisterairshow.com/helpusplan.php .
    I went ahead and created recordsets using advanced recordsets and these seem to be working, here's a sample SQL
    SELECT *
    FROM plan
    WHERE Saturday = 'Saturday' AND plan.howArriving = 'Auto'
    I created a recordset for each combination of day and transportation mode - six in all
    This selected the correct records.
    To display the count of how many records selected I then used in DW Insert/Data Objects/ Display Record Count/Total Records which generated the following code:
    <?php echo $totalRows_rsSatAuto ?>
    This worked OK - not elegant but OK and I repeated it for each combination of Day and Transportation mode!!
    So there are two problems I'm having:
    I know I can select the records I want but how do I display the sum of the column containing "How many in your party" - i.e. in the PHP code generated above what do I replace $totalRows_rsSatAuto with?
    There are two questions using radio buttons where I'd like to display the count and % for each option selected. I can select all records for these questions but what code do I put to sum the number of selections for each option and what code do I put to calculate the percentage
    I understand the arithmetic involved which is pretty simple but it's the mechanics of coding that has me stumped. It would really help if you could give me a sample for say the "Are you camping overnight" question which has a "Yes/No" option only. In my mundane way I would create two recordsets, one for "Yes" and one for "No", and use the same technique I describe above for counting Total Records in each recordset, but then I'm stuck with how do I calculate and display the percentages. I must be missing something very obvious as I'm sure there just has to be a more elegant solution.
    Thanks so much for your continued interest.
    Tony

Maybe you are looking for

  • Windows Vista not recognizing my new 160GB ipod classic

    I'm having a terrible time getting Windows Vista or itunes to recognize my 160GB ipod classic (ipod software version 1.0.3 PC). I've spent the last two days going through the 5 Rs (4 or 5 times, now)... updated all the USB drivers... reassigned my sl

  • How do I find the serial number of my stolen macbook?

    I recently had stolen my macbook, macbook pro and iphone....and other than retrieving the MEID number of my Iphone, I did not have the serial numbers of the macbooks listed anywhere and I also bought these used online so I did not have a receipt with

  • Smart View Vs Web data form entry

    Hi I am currently developing a planning model that is due to be rolled out a number of non finance users. I find entering data on a web form quite time consuming and not very user friendly. For example when scrolling across left to right the screen d

  • How to transfer iTunes Library/iPhone data from PC to Mac?

    Hi, I have just started using my Mac Mini. This is my first mac. I need to copy my iTunes Library from my PC to Mac. I searched for a solution and most of them advise to simply copy the iTunes folder to my Mac. The problem is I am not sure if this ap

  • MAC Pro first generation PCIe Slots 1 and 2: are the y equal?

    I have an X1900 XT card and I wanna replace the stock GPU cooler with an off-market one which needs some space below the card as well as above it. I am a bit confused on the informatin I get around about the PCIe slots on Mac Pro (Dual dual cores 3.0