Is there a Java Obiect that will arrange data in alphabetical order?

Is there a Java Obiect that will arrange data in alphabetical order?
So no matter what order you add or put things into the object it will only return them in alphabetical order.
Edited by: Easter1976 on Nov 5, 2007 9:55 AM

No, you will either have to create a comparator, a sorter, or write the compareTo in such a way that it sorts your data by your wanted fields.
So, given the class Student, you probably want something like this:
public class Student implements Comparable<Student> {
     public int compareTo(Student s) {
          if (getLastName().compareTo(s.getLastName()) != 0)
               return getLastName().compareTo(s.getLastName();
          if (getFirstName().compareTo(s.getFirstName()) != 0)
               return getFirstName().compareTo(s.getFirstName();
          return 0;
}After that, you may sort your list of students with Collections.sort(myListOfStudents);
Alternatively, you may do it like this:
Collections.sort(myListOfTypeSomething, new Comparator<Something>() {
     public int compare(o1, o2) {
          return o1.getAlphaSomething().compareTo(o2.getAlphaSomething());
     });

Similar Messages

  • IS THERE AN ADD ON THAT LISTS YOUTUBE PLAYLISTS IN ALPHABETICAL ORDER?

    I WANT TO GO INTO MY YOUTUBE PLAYLIST AND BE ABLE TO MAKE THE LIST ALPHABETICAL!!! IS THERE AN ADD-ON FOR THIS? OR DOES ANYONE KNOW HOW TO MAKE THIS HAPPEN. HAVE MANY VIDEOS AND I'M TIRED OF TRYING TO FIND WHAT I WANT. ALPHABETICAL LISTING IS VERY QUICK. PLEASE HELP. SINCERELY, KAPAMAN

    Dear Gnittala,
    I was not trying to be rude. I have cataracts and cannot see very well. So when I type I use capitals. I'm didn't mean to offend. I'm new to the web and believe that being rude comes from what you say and the words you use when speaking to someone, not how you type the words. I've visited forums where people are putting others down and swearing, but every word is typed in lower case letters. But thanks for the lesson in etiquette, I will just magnify my screen and type in the lower casing.
    Thanks for the info about YouTube, but I've seen these already. Truly with so many people complaining about the alphabetical order being remove as an option for your playlist in You Tube, you would think they would put it back. Sincerely, KAPAMAN, kapaman, sorry ha ha

  • I NEED A FORM THAT WILL PUT NAME IN ALPHABETIC ORDER.  THIS FORM NEEDS TO HAVE COLUMNS WITH HEADERS.

    I NEED A FORM THAT LISTS NAMES IN ALPHBETIC ORDER ON THE LEFT SIDE GOING DOWN.  THIS FORM ALSO NEEDS COLUMNS THAT HAVE PRODUCT IDENTIFICATION ON THE TOP OF THE COLUMNS.

    Hi,
      Is your question in the context of the responses that you collect (this is the View Responses tab) or the actual form that your end users will see?
    In a nutshell, (1)  a field in your form corresponds to a column in the responses table. (2) the caption text of the form field will be the column header (show up at the top of the column). (3) to list names in alphabetical in your form, you can use choices fields, like multiple choices field or drop down field - you will have to enter the name in alphabetical order manually.
    Hope this helps,
    Thanks,
    Lucia

  • How to automatically arrange data in alphabetical order

    Hi,
    I want to expand  a program.In the block diagram as well as in the front panel I am using manual entry. But it is not in order. Is there away to automatically order the entry.
    In the attached zip file run the vi "SPEECH TO SIGN LANGUAGE CONVERTER"
    I want to expang the "Phrases" in the front panl and corresponding comands in the block diagram.
    Attachments:
    Control Indicators With Voice.zip ‏521 KB

    See this thread. Alphabetical order
    Nghtcwrlr
    ********************Kudos are alwayzz Welcome !! ******************

  • HT4759 I want to use icloud mail on both iPhone 4s AND my pc. icloud mail on PC is mega glitchy and frustrating because my PC is ancient, I run XP, & these DO NOT MEET req's for iCloud.  Is there a email platform that will run well on both XP and iPhone?

    I NEED to use icloud mail on both iPhone 4s AND my PC. I need to use both. 
    Trying to use icloud mail on PC is mega glitchy (STOP SCRIPT WARNINGS EVERY FEW MINUTES) and frustrating because:
      1.  my PC is ancient (but nicely refurbished/fast)
      2.  I run XP  (with both Firefox and Chrome- newest versions)
      3.  thusly, I DO NOT MEET SYSTEM REQUIREMENTS for iCloud.
    In my passed attempts I found that
    1. Yahoo doesn't work well on iPhone
    2. Gmail doesnt work well on iPhone.
    I must be missing something... an app or... maybe a donated/ NEW FREE MAC!  (That would be sweet!  Ha.)
    Is there an email platform that will run well on both XP and iPhone?
    or... Please say it isn't true: I would love a Mac tablet or desktop. We have no money for a mac. SOL?   Is this iCloud apple tech only for wealthy middle class and above who can afford to have the newest and best of everything? 

    @Naiks, having suffered through unsuccessful synching attempts for Calendar and Contacts myself, l would suggest you try the following:
    UNINSTALL iCloud control panel from your PC. Seems silly, but do it.
    Go into Outlook, and look at the very top menu. Click FILE, then ACCOUNT SETTINGS, then click the popup box.
    You will see a list of all your email accounts. Make sure that ONE of them has a checkmark against it. If not, select the account your want as your default, and click "set as default.
    Exit out of Outlook and reboot your machine.
    Now reinstall iCloud, check CALENDAR and CONTACTS, and do as instructed when prompted.
    Reboot for good luck and now launch OUTLOOK. All that remains is to locate your iCloud Contacts and Calendar files, and make them your default.
    IMPORTANT: Don't panic if you can't find your contacts -- they're there. Click CONTACTS and you'll see you have several available contact files. Locate the one label "iCloud" in grey type. Right-click on it, select PROPERTIES, then click the Outlook Address Book tab. Check the box that says something like "Make this my default Outlook Address Book." Keep clicking "apply" and "okay" until you've exited out of the dialog box maze.
    You may have to do something similar with your Calendar files. I dd not, but if you need to, do it.
    Everything should now sync pretty seamlessly.
    I didn't have the exact same problem as you, but my dilemma was close enough. Good luck!
    Arthur P. Johnson

  • My MacBook Pro is running very hot after lion install.  Are there any hardware changes that will help? What can I do to get it back to normal?

    My MacBook Pro is running very hot after lion install.  Are there any hardware changes that will help? What can I do to get it back to normal?

    I get the impression that most of the users on older hardware experiences similar temperature issues on Lion for a long time now. Awaiting for confirmation from the original poster.
    In the meantime I'm just cautious with regards to pushing the machine to such extreme temps, since something tells me such behaviour which includes monitor flickering and the likes is nothing but abnormal for any type of use...
    Any clues if 10.7.5 does anything on this? If not I'm afraid i see myself going back to SL for good...

  • I would like to play music from my iphone 5s on a sound bar with an iphone 3 dock. Is there an adapter available that will play audio please?that will play audio please

    I would like to play music from my iphone 5s on a sound bar with an iphone 3 dock. Is there an adapter available that will play audio please?

    The genuine Apple adapter works for me, most cheap knockoffs do not support sound ,it is usually in the micro print at bottom of the ebay offerring
    It is pricey by comparison but it works and the knock offs usually don't pay the patent  licence fee hence they guess the technology that is in the lightning plug
    and charge a minimal price

  • Is there a plug-in that will allow me to view CR2 (raw) files from a Cannon 5D Mark III to PSE 9 ?

    is there a plug-in that will allow me to view CR2 (raw) files from a Cannon 5D Mark III to PSE 9 ?

    The 5D.3 was first supported in ACR 6.7 which you need PSE 10 to use, so there is no plug-in for PSE9 that will allow opening the files from a camera newer than when PSE9 became obsolete.
    Besides getting PSE12, assuming it is supported on your current computer—check the specs, you can use the free DNG Converter available from http://www.adobe.com/downloads/updates.html 
    to convert your CR2 files to DNG files that are compatible with older versions of ACR.  Be sure to set your DNGC compatibility settings to a version old enough to be openable with PSE 10’s ACR.
    As far as whether the OP is serious, it doesn’t hurt to ask the question before spending money on something you didn’t need.

  • HT1386 i have albums that will not sync now. I have only owned my ipod for 5 mo and it appeared to sync fine. Now it say that the process is complete but there are 3 items that will not sync to my ipod. I i just purchased from the store!!

    i have albums that will not sync now. I have only owned my ipod for 5 mo and it appeared to sync fine. Now it say that the process is complete but there are 3 items that will not sync to my ipod. I i just purchased from the store!! please help! thanks maggibnd

    Do they play in iTunes?
    Can you directly redownload them by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Is there a cable available that will connect an I pad to an older printer?

    Is there a cable available that will connect an I pad to a printer?

    If you have a Mac or PC there are utilities available that enable them to act as a print server, enabling you to print to any printer the Mac or PC can use.
    The donation-supported handyPrint and a commercial product such as Printopia ($19.95 with free trial) are two examples. The Mac must be "on" but may be asleep for them to work. Equivalent PC options may exist but you're on your own finding them.
    You can also buy this standalone print server:
    http://www.lantronix.com/it-management/xprintserver/xprintserver.html
    These options enable you to use any printer available to your network, even older ones that may predate AirPrint by decades. But as Bob said, everything you do with an iPad is wireless.

  • Is there one converter program that will convert these three formats:  cda, wma, and midi to mp3?, Is there one converter program tha t will convert these three formats:  cda, wma, and midi to mp3?

    Is there one converter program that will convert these three audio formats:  cda, wma, and midi to mp3?

    Hi Illaass,  Oh yes for days and I even called and email some asking this question and no one I could find did all three so I only have to buy one program.  The one I was going to download because it did two of them I read the reviews and 2 people said that a hacker was attached to the download and they changed all his search features amoung other things.  So I got out of there and that was the end of that.  That's why I decided to try this in case someone knows the answer.  Thanks for responding though.  Sandi

  • Is there any Java library that can invoke access point functions?

    Hi, Is there a Java Library that enables programs to access access point and run their functions?
    I want to create sample code that invokes functions of access points such as signal strength e.t.c.
    My ambition is to create a model that can identify the position of wareless devices such as PDA in a wireless LAN

    Thanks for your reply, sorry I have not gotten back sooner. I'm still having the problem.
    All the access points have the same SSID. I did try deleting the network and rejoining, however, I don't think it properly "forgot" all the settings when I did that. I haven't yet taken the time to try to delete the network more thoroughly. I'm still turning off airport, carrying the laptop to within a few feet of the access point I want to join, and turning airport back on, on an almost daily basis.

  • Is there a Terminal command that will pick up DNS numbers?

    Hello all,
    Is there a Terminal command that will pick up the DNS numbers utilized by a router?
    The router options don't show any, though the router is set to use PPPoA to pick them up.
    I kindly TIA,
    Eme '~[ )♥♪

    Hi, Thanks for the reply, I appreciate it.
    What do you mean by "pick up"?
    I mean to show what the DNS numbers are that the router is using.
    They are not entered in the DNS server field in Networks, TCP/IP tab.
    If you mean refresh the client settings, the DNS settings are obtained as part of the DHCP lease (or PPP connection in the case of PPP).
    The user/ OP is actually using PPPoA, when i googled PPPoA.. seems he is using Cisco perhaps.
    http://en.wikipedia.org/wiki/Point-to-PointProtocol_overATM (Asynchronous Transfer Mode)
    "PPPOA or PPPoA, Point-to-Point Protocol (PPP) over ATM, is a network protocol for encapsulating PPP frames in ATM AAL5. It is used mainly with cable modem, DSL and ADSL services.
    It offers standard PPP features such as authentication, encryption, and compression. If it is used as the connection encapsulation method on an ATM based network it can reduce overhead slightly (around 0.58%) in comparison to PPPoE".
    Essentially the original poster removed the OpenDNS #s from his DNS server field in the TCP/IP tab (b/c they seem to make Adobe.com inaccessible to him)
    removing them & allowing his router to "pick them up from the ISP" seems to solved his problem.
    However he can not, find what the numbers are that are being utilized,
    b/c they are not entered as usual in the Network, & part of the DHCP lease,
    or in Airport admin Utility.
    I/ we wondered, if there was a Terminal command that will show what the
    numbers are that are being used .
    Does that help clarify what I mean? Sorry to be so long winded.
    Eme '~[ )♥♪

  • At the moment I have a long Griffin charging cable. Unfortunately now that I have the Smart Case this won't fit through the available hole. Is there any other make that will fit that has the none  lightening fitting that I want.

    At the moment I have a long Griffin charging cable. Unfortunately now that I have the Smart Case this won't fit through the available hole. Is there any other make that will fit that has the none  lightening fitting that I want.

    I wonder if this comment on the Amazon site is the answer to my problems?
    PLEASE NOTE: In order to provide the same power output as an original 3 ft Apple USB cable, the housing of our 6.5 ft cables need to be a bit larger. Due to the larger head size, it will not be compatible with some cases that have a smaller charger opening
    If that is the case then I am stuck with the Griffin one or just use the original.
    Thanks for your observations guys

  • I use an iMac running V. 10.10.2.  I have an Epson WP-4530 printer.  Is there a printer driver that will enable one to print photos from color negatives?

    I use an iMac running V. 10.10.2.  I have an Epson WP-4530 printer.  Is there a printer driver that will enable one to print photos from color negatives?
    I have already tried downloading the drivers from Epson as per one person's suggestions, but the dialog box isn't anything like what was suggested--the choices in the box weren't the same for the most part.  I don't want to lock up the computer or disable the printer for normal printing, but I have a lot of old negatives that I would love to have prints from.

    I am using the latest software from Epson for Mac OS 10.10.2 that I downloaded last week.  I seem to remember that the older software (we're talking 6-8 years ago) had to option to scan slides or negatives and would convert the results into positives via the scanner.  I don't like the most recent scanning software because it jumps right into the scan before giving you a chance to change the options.  It uses the selected options from the previous scan which are sometimes right, sometimes wrong.  Thanks for your reply to my question!

Maybe you are looking for

  • CO-PA Extraction problem

    Dear all, I created CO-PA datasource with costing-based. When I test extraction (RSA3) in R/3 with no any selection criteria, it only extracts a few data. When I check the CE4XXXX table, there are tons of data in it. It seems like that it gets data f

  • How do I move photo's to a portable hard drive

    How do I move photo's to a portable hard drive?

  • Smart view- Sync Back to Server.

    Hi All, I am working with Smartview offline planning, i would like to take one dataform as offline & perform some calculations (operations) on it and sync back to server . What i have done is : I am taking one form as offline with a local connection

  • Where's the RAID???

      After a year or so of good behavior, my RS480M2-IL based system crashed.  I could not boot from ANY of my four drives in RAID or IDE modes.  I have four Seagate 160GB SATA drives:  two were in a RAID 1 set for the software and critical files and tw

  • OTN Down again?

    Hi, Cannot access link http://www.oracle.com/technology/software/products/ias/htdocs/101401.html error - Website cant be found Customer SR: SR 19615096.600 UNABLE TO DOWNLOAD IDENTITY MANAGEMENT FROM OTN Could someone look into this asap, Regards, Na