How can i check to see if an object is already in the array list?

while (res.next()) {
                Schedule schedule = new Schedule();
                customerName = res.getString("CUSTOMERNAME");
                schedule.setCustomerName(customerName);
                magName = res.getString("MAGNAME");
                schedule.setMagName(magName);
                System.out.println("NAME: " + customerName);
                System.out.println("MAGNAME: " + magName);
                if(!scheduleListH.contains(schedule))  //this won't work
                    scheduleListH.add(schedule);
            }schedule object has 2 fields, customerName and MagName;
Basically i want to say, IF the scheudleList (which is an array list) contains an object schedule that has the same customerName and MagName as any of the objects in the array list, don't readd the object.
ANy help would be great!

Thanks!
Oops I forogt I could use the .contains, i also tried that but still no luck.
There is no compiler error but here is an example of the output:
Populating scheudle list for HOLIDAY selection data structure: 
NAME: Cory
MAGNAME: Merlin
NAME: Brandon
MAGNAME: Gondorf
NAME: Chris
MAGNAME: Houdini
NAME: Lokie
MAGNAME: Blaine
Sample SCHEDUEL H [Cory          Merlin, Brandon          Gondorf, Chris          Houdini, Lokie          Blaine]As you can see, There are 4 objects in the array list:
Cory Merlin
Brandon Gondorf
Chris Houdini
Lokie BLaine
Now this function is called everytime the user choses a new item in a combo box.
So if they go back to the previous selection, Holiday's, it shouldn't read add all the orginal things.
But if I go up and select the same item in the combo box it changes whats in the array list to the following:
Populating scheudle list for HOLIDAY selection data structure: 
NAME: Cory
MAGNAME: Merlin
NAME: Brandon
MAGNAME: Gondorf
NAME: Chris
MAGNAME: Houdini
NAME: Lokie
MAGNAME: Blaine
Sample SCHEDUEL H [Cory          Merlin, Brandon          Gondorf, Chris          Houdini, Lokie          Blaine, Cory          Merlin, Brandon          Gondorf, Chris          Houdini, Lokie          Blaine]Here's my whole function if your interested and where I call it:
    void populateSchedule(String holiday) {
        Statement sta = null;
        Connection connection6 = null;
        try {
            connection6 = DriverManager.getConnection(URL, USERNAME, PASSWORD);
            sta = connection6.createStatement();
            //getting the list of magicians from the selected holiday to see if any are free
            ResultSet res = sta.executeQuery(
                    "SELECT CUSTOMERNAME, MAGNAME FROM SCHEDULE WHERE HOLIDAYNAME = '" + holiday + "'");
            String customerName = " ";
            String magName = " ";
            System.out.println("Populating scheudle list for HOLIDAY selection data structure:  ");
            //this is where I add the waiting list objects to the array that will later be used
            //to print out and shown to the user when they select the waiting list status
            while (res.next()) {
                Schedule schedule = new Schedule();
                customerName = res.getString("CUSTOMERNAME");
                schedule.setCustomerName(customerName);
                magName = res.getString("MAGNAME");
                schedule.setMagName(magName);
                System.out.println("NAME: " + customerName);
                System.out.println("MAGNAME: " + magName);
               if(!scheduleListH.contains(schedule))
                   scheduleListH.add(schedule);
            System.out.println("Sample SCHEDUEL H " +   scheduleListH);
        } catch (SQLException ex) {
            System.out.println(ex);
            ex.printStackTrace();
        } finally {
            try {
                sta.close();
                connection6.close();
            } catch (SQLException ex) {
                Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
//this is where i call in the GUI
    private void specStatusComboBoxActionPerformed(java.awt.event.ActionEvent evt) {                                                  
        // TODO add your handling code here:
        String selectedItem = (String)specStatusComboBox.getSelectedItem();
        String groupSelectedItem = (String) groupStatusComboBox.getSelectedItem();
        if(groupSelectedItem.equals("Holidays"))
            //get customer name and magician name from the Scheduel table
            //use selectedItem (it will be a holiday name)
            //magicDB.clearScheduleHList();
            magicDB.populateSchedule(selectedItem);
            ArrayList<Schedule> tempScheduleList = magicDB.getScheduleHListCopy();
            outputTextArea.setText(" ");
            outputTextArea.setText("CUSTOMER NAME" +"\t\t" + "MAGICIAN NAME" + "\n");
            for(int i = 0; i < tempScheduleList.size(); i++)
                outputTextArea.append(tempScheduleList.get(i).toString() + "\n");
    }   I'll reward the duke stars anyways because you have been a great help either way!

Similar Messages

  • I have an iMac running OS 10.4.11. How can I check to see if I have the Flashback Trojan (and remove it, if I have it)? IMy Safari is also crashing frequently. Any suggestions?

    I have an iMac running OS 10.4.11. How can I check to see if I have the Flashback Trojan (and remove it, if I have it)? IMy Safari is also crashing frequently. Any suggestions?

    Hi Barry, is this an Intel iMac, or a PPC iMac?
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets
    Flashback - Detect and remove the uprising Mac OS X Trojan...
    http://www.mac-and-i.net/2012/04/flashback-detect-and-remove-uprising.html
    In order to avoid detection, the installer will first look for the presence of some antivirus tools and other utilities that might be present on a power user's system, which according to F-Secure include the following:
    /Library/Little Snitch
    /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
    /Applications/VirusBarrier X6.app
    /Applications/iAntiVirus/iAntiVirus.app
    /Applications/avast!.app
    /Applications/ClamXav.app
    /Applications/HTTPScoop.app
    /Applications/Packet Peeper.app
    If these tools are found, then the malware deletes itself in an attempt to prevent detection by those who have the means and capability to do so. Many malware programs use this behavior, as was seen in others such as the Tsunami malware bot.
    http://reviews.cnet.com/8301-13727_7-57410096-263/how-to-remove-the-flashback-ma lware-from-os-x/
    http://x704.net/bbs/viewtopic.php?f=8&t=5844&p=70660#p70660
    The most current flashback removal instructions are F-Secure's Trojan-Downloader:OSX/Flashback.K.
    https://www.securelist.com/en/blog/208193454/Flashfake_Removal_Tool_and_online_c hecking_site
    More bad news...
    https://www.securelist.com/en/blog/208193467/SabPub_Mac_OS_X_Backdoor_Java_Explo its_Targeted_Attacks_and_Possible_APT_link
    Removal for 10.5...
    http://support.apple.com/kb/DL1534

  • How can I check and see if someone is tracking online activity on my IPad 3 from their device?

    How can I check to see if someone is tracking or accessing my Internet activity on my Ipad3 from a separate location?

    You can't. Make sure you have security/firewall set on your router. If you are using your iPad in a free wifi location (ie like Starbucks) it's possible for someone to intercept your wifi activity.
     Cheers, Tom

  • How can I check to see if there is money left on an iTunes card if I can't read the scratch off code?

    How can I check to see if there is money left on an iTunes gift card if I can't read the scratch off code?

    Sorry, but other than trying to redeem the card there's no way to check whether it is still valid or was previously redeemed.
    Regards.

  • HT1212 If I never synced to itunes and I restore the device. Will I lose unstored data? How can I check to see the last time my phone was backed up if I forgot the passcode to my phone?

    If I never synced to itunes and I restore the device. Will I lose unstored data? How can I check to see the last time my phone was backed up if I forgot the passcode to my phone?

    If you can't remember your passcode, you'll need to restore your phone.  If you never synched to iTunes, all data on your phone will be erased.  No way around this.

  • How can I check to see if my version of QuickTime Pro 7.6.6 already has ProApps QuickTime Codecs installed? I also have Final Cut Pro 6. I'm asking because my computer can't seem to play ProRes 422 codec video without stuttering or skipping?

    I have a fairly capable MacBook Pro (2.93 GHzIntel Core 2 Duo processor, 4GB 1067 MHz DDR3 memory and a 1TB HD -5400 rpm, so I am hoping it's not that my computer that can't support it and it's something more simple like not have ProApps QuickTime codecs installed. Thanks in advance!

    How can I check to see if my version of QuickTime Pro 7.6.6 already has ProApps QuickTime Codecs installed? I also have Final Cut Pro 6. I'm asking because my computer can't seem to play ProRes 422 codec video without stuttering or skipping?
    If you can view a ProRes 4-2-2 video at all, then you either have the independent ProRes422 Playback component installed or the FCP "Pro" video components installed.
    I have a fairly capable MacBook Pro (2.93 GHzIntel Core 2 Duo processor, 4GB 1067 MHz DDR3 memory and a 1TB HD -5400 rpm, so I am hoping it's not that my computer that can't support it and it's something more simple like not have ProApps QuickTime codecs installed.
    Check your "~/Library/QuickTime" folder for your various "Pro" components. If in doubt that you have them all, re-run the FCP installer and it should add any missing components, apps, or utilities.

  • How can I check and see that my photos are being backed up by time machine?

    How can I check and see that my photos are being backed up by time machine?

    http://pondini.org/TM/8.html

  • How can I check to see if my iPad is factory unlocked

    Hi, I'm having problem using a sim in my iPad when there is no Wi-Fi. I have been told that iPads lock to the first sim that is installed. As I have now changed my network provider, could this be the reason my new sim does not work?
    If this is the case, how can I check to see if the iPad is still unlocked, as I do not have another sim card to try. More importantly, How do I unlock my iPad???
    Thanks for your help
    RM

    The only iPads that are unlocked (for use in the US) are iPads that shipped with the Apple Sim card.  I believe that is the iPad Air 2 and the iPad Mini with Retina.  The other iPads are locked to the carrier they were purchased for use with, and that cannot be changed.  The only exception would be in using a sim card in another country. 
    If it is an AT&T iPad, you have to use AT&T.  Same for Sprint, Verizon & T-Mobile.

  • HT5035 how can i check or see the remaning balance that i have in my itunes account

    how can i check or see the remaning balance that i have in my itunes account

    On what device/computer?

  • How can I check to see if my software has been registered?

    After a recent hardware replacement I am unable to find my Aperture 2 download. I never used it anyway so i'm not concerned but would like to be able to pass it on if it can be, is this possible? How can I check to see if I even registered it? I have the original packaging and all contents including Serial numbers, support ID, and four software coupons for updates. I am a bit technophobe, sorry!
    So,
    1. How can I check to see if it was registered correctly?
    2. Can someone else use the software?
    Hope someone can help.

    You don't need to check registration. In the Apple world registering software really doesn't have much of a purpose.
    If the software was bought on DVD and you have the serial number you are free to give it or sell it to anyone you wish.  Just keep in mind that Aperture 2 is very old and while it (sort of) works on the newer OS's it really isn;t a good solution for anyone serious about using Aperture. 
    It would be OK for someone with older hardware that is unable to upgrade past Snow Leopard but for anyone with newer hardware it would be a mistake to use.

  • How can I check to see if there is an older version of an app compatable with 4.2.1 before purchase?

    how can I check to see if there is an older version of an app compatable with 4.2.1 before purchase? I don't want to buy an app later to realize there isn't a version supporting my Ipod...

    Apple does not track iPhones reported as stolen, nor
    has AT&T claimed that it currently does so but has
    announced that it is considering doing so in the future.

  • Hello!!!ho​w can I control an omron plc (sysmac cqm1)with an OPC server?I want to adquire a signal controllin​g its amplitude and frecuency.​How can it be done with OPC server?I already have the NI CD of OPC drivers.Th​ank you

    Hello!!!how can I control an omron plc (sysmac cqm1)with an OPC server?I want to adquire a signal controlling its amplitude and frecuency.How can it be done with OPC server?I already have the NI CD of OPC drivers.Thank you

    Hola Jose David, que OPC estas utilizando?, Si tienes comunicación entre tu computadora y PLC pero falla la comunicación entre el OPC y el PLC? La configuración y direcciones entre los dos es correcta? La comunicación es por cable serial?
    Espero tus respuestas
    Saludos
    Benjamin C
    Senior Systems Engineer // CLA // CLED // CTD

  • How can I check to see if a plug-in or something else is preventing me from accessing a certain app?

    Hello, Thanks in advance for any help. I'm an elementary teacher who is having trouble accessing my online grade book from my mac. The publisher if the gradebook app is Pearson. My school district technology dept. has not been helpful at all, but a family member who knows about these things helped me and many other teachers in my district discover that using Firefox and accessing "the old launch" of the gradebook app will allow mac users access. My problem is that I cannot even get into the "PowerTeacher" area (portal?) that leads me to the gradebook. It has been suggested to me that perhaps there is a plug-in I have that is conflicting somewhere along the way. Others have been successfully logging in, so I'm guessing it is something just with my version of Firefox or other... If someone can help me with this frustrating problem, I will be forever grateful!

    Hello,
    # Click the ≡ Menu Button and choose Add-ons.
    # Click Plugins on the left.
    # Set "Default Browser Helper" to Never Activate.
    #* [http://www.aeyoun.com/posts/default-browser-plugin.html Mavericks’ weird little “Default Browser Helper” plug‐in injected into all web browsers | Aeyoun]
    The remainder of your plug-ins handle various web content. At best, I could see them causing problems when disabled, not the other way around. You probably meant extensions: see the last step at the bottom of this post.
    # [[Update Firefox to the latest version]]
    # [[How to clear the Firefox cache|Clear the Firefox cache]]
    # [[Delete cookies to remove the information websites have stored on your computer|Delete cookies from the site in question]]
    # If that doesn't help, check if the problem occurs when you start Firefox with add-ons disabled (AKA Safe Mode).
    #* [[Troubleshoot Firefox issues using Safe Mode]]

  • Bought an iphone on craigslist how can i check to see if its stolen

    does anyone know where i can check to see if an iphone was stolen

    There is no publicly available database of stolen iPhones.
    You can ask the local police; but they will only know about iPhones
    reported as stolen locally and not elsewhere in the state/county/shire/country/world.
    You can enter the serial number here to see if Apple shows the
    iPhone as having been replaced (common insurance scam in some
    countries), but the information is only as good as the insurance/
    wireless carrier reports to Apple.
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How do I check to see if a channel group exists in the data portal?

    I have a list of channel groups in the data portal but sometimes some channel groups  are not created all the time.  How do I check using a script if a channel group exists or was created.

    Hello jreynolds!
    With the command 'GroupIndexGet'. It returns 0 if the group does not exist.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

Maybe you are looking for

  • Back up iphone to icloud?

    How do I back up my iphone to the icloud?

  • Exception while running Petstore

    I installed the Petstore according to the following: Win XP ( I tried Win2000 as well ) J2EE 1.3.1 JDK 1.4.2_10 I did everything as the Petstore installing.html told me but I have the exception as follows. I browsed the web and found these links but

  • Product Menu items grayed out in Xcode

    I am a beginner in Xcode, I was working on a tutorial material with a basic calculator project and when I added an icon file to the project the Run or any of the Product Menu options got grayed out. Previous to this change everything was running and

  • I cannot get bb attachment services back

    I cannot get bb attachment services back.  It is missing from apploader.  I think this is what I took off by mistake and it remove my external display.  Please help.  I have tried multiple suggestions to set to factory, but none worked for my BB Pear

  • Unacceptable

    I purchased a song on the iTunes store, and I wanted to use it as my Ringtone on my iPhone. It didn't show up as a playable ringtone, so I used the "Create Ringtone" utility to make one. I then found out that I would have to buy this ringtone that I