Help please!! Arraylist Search/Count

Hi everyone,
I'm very new to Java. My problem is this:
I have created a program that parses many XML files. Now I want to generate a report of the number of files that contain each unique date within the xml files.
For example:
Using the Filewriter, I will like to write the number of files out of the 100 present that contain the following dates:
2005-07-12
2005-08-11
So far my attempts are to store all the dates parsed into an arraylist. I've tried using the popular wordcount.java and many other examples to no avail. If there are any methods out there that can help me count the unique items present in the arraylist, I will really appreciate it.
If I going about it the wrong way and there's a better way, can some also be shout it out.
Many many thanks

If you can able to store all the dates in an array
list and want to find the uniques dates in that array
list, then this program is enough...
import java.util.*;
import java.awt.*;
public class forTelly{
ArrayList al;
forTelly(){
al=new ArrayList();
String s[]={
2005-07-12","2005-08-11","2005-07-12","2005-08-11",
2005-04-12","2005-03-11","2005-02-12","2005-01-11",
for(int i=0;i<s.length;i++)
al.add(s);
/* so now we can consider that your source
arraylist is al from this we are going to
find the number of unique dates...okay.....
rrayList aldest=new ArrayList();
/* we can create another array list in
which we will add all the unique date
for(int i=0;i<al.size();i++){
if(aldest.size() < 1)
aldest.add(al.get(i));
else{
if(!aldest.contains(al.get(i)))
aldest.add(al.get(i));
System.out.println("So the number of unique address
in the source Arr..Li...is:"+aldest.size());
public static void main(String args[]){
new forTelly();
Is this what you want???
Note: That < symbol may change to <> or >< so please
correct it...
pravinth,
Thanks for the code. I've already tried this snippet and it doesn't quite do what I need it to do as I have to cast the arraylist of objects to an string array  and then even when I do it still prints all the dates with the number of occurences instead of a simply summary of say:
2005-07-12: 2 files
2005-08-11: 2 files
2005-01-11: 1 files
etc. etc.
Will appreciate any further thought on this.
Thanks,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Help Please with searching Hard Drive for MP3's etc

    Right I installed ITunes and in the install it said do you want ITunes to search your harddrives for MP3s to add to the library. Which I said Yes. I have all mu music on a 200gb External Hard Drive.
    WHen it finished the search I had 5 files in my library that were on my desktop.
    How do I ask ITunes to search my external harddrive for the rest of my music without importing individually??
    Many Thanks in Advance

    Just use the Add to Library command (under the File menu) and select the folder(s) on your external drive in which your music is stored.

  • I downloaded an upgrade to my adobe reader today, and ever since my search engine has switched to yahoo and wont change back to google. I have a macbook pro, help please? Does anyone know how I can change this back? I have tried through my settings but it

    I downloaded an upgrade to my adobe reader today, and ever since my search engine has switched to yahoo and wont change back to google. I have a macbook pro, help please? Does anyone know how I can change this back? I have tried through my settings but it doesnt work

    Hi Timia,
    If you are using Safari as a web browser :-
    Open Safari, go to Safari menu > Preferences > General, and put Google as the homepage. Then, choose Google as your default search engine.
    If you are using Google Chrome as the web browser :-
      Open Google Chrome.
      In the top right corner of the page, click the Chrome menu Chrome menu > Settings.
      In the "Search" section, select Google from the drop-down menu.
    Let me know if you still experience any issue.
    Regards,
    Aadesh

  • After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.

    After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.Urgent.TQ

    Izit software or hardware? Confuse:(
    Only can use wifi now.
    Any way thanks guys for ur suggestion:) amishcake and simes

  • I backup to an external hdd with Time Machine, when it ran out of space it did not delete old backups, now my internal hdd says its full when before it had heaps of space. I have searched for extra files but cant find any. Can anyone help, please.

    I backup to an external hdd with Time Machine, when it ran out of space it did not delete old backups, now my internal hdd says its full when before it had heaps of space. I have searched for extra files but cant find any. Can anyone help, please.

    First, empty the Trash if you haven't already done so. Then reboot. That will temporarily free up some space.
    To locate large files, you can use Spotlight as described here. That method may not find large folders that contain a lot of small files.
    You can also use a tool such as OmniDiskSweeper (ODS) to explore your volume and find out what's taking up the space. You can delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Proceed further only if the problem hasn't been solved.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    Install ODS in the Applications folder as usual.
    Triple-click the line of text below to select it, then copy the selected text to the Clipboard (command-C):sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means.
    When you're done with ODS, quit it and also quit Terminal.

  • HT204266 I am trying to download Tap Tap Revenge on my new Ipad air..however..i searched for it in the App Store but there are none...help please..i really love this game! Is there something wrong with my App Store or my ipad??

    I am trying to download Tap Tap Revenge on my new Ipad air..however..i searched for it in the App Store but there are none...help please..i really love this game! Is there something wrong with my App Store or my ipad??

    It looks like the app is not currently in the App Store, I can't find it in the UK nor US stores.
    If you had previously downloaded it then do you have a copy on your computer's iTunes so that you can sync it to your iPad ?

  • I just updated my 3gs to iOS5 and it keeps on saying cannot activate iphone.. after searching videos how to activate it.. i can't tap my three fingers because there is no clock showing on my screen. how do i go about it? help please.

    i just updated my 3gs to iOS5 and it keeps on saying cannot activate iphone.. after searching videos how to activate it.. i can't tap my three fingers because there is no clock showing on my screen. how do i go about it? help please.

    i have the exact same problem and im still currently trying to figure out how to activate it

  • 2 errors: "Your iPhone could not be activated because the activation server is temporarily unavailable" and the sim says "searching" while iTunes says there is "No Sim installed" - but of course, there is! Any help please??

    2 errors: "Your iPhone could not be activated because the activation server is temporarily unavailable" and the sim says "searching" while iTunes says there is "No Sim installed" - but of course, there is! Any help please??

    Hi Peter,
    Thank you for the note - I have seen similar replies on other posting errors and I see how that could make sense. The thing is, my iPhone is not jailbroken - it is from an authorized distributor. However, when I told them about the "no service" problem on the sim, they were unable to assist. Then my phone messaged that an itunes restore was required - so I did that, several times, to the error message now noted on my post. I wonder if there is some other way to over-write this message? Thanks very much.

  • My ipod nano FM radio does not work it only has European band and japan band and when you search to find a radio station I cant hear anything. Help please!!

    my ipod nano FM radio does not work it only has European band and japan band and when you search to find a radio station I cant hear anything. Help please!!

    Hi kahli:
    Have a look at  http://manuals.info.apple.com/en_US/iPod_nano_5th_gen_UserGuide.pdf
    AND
    http://manuals.info.apple.com/en_US/iPod_nano_5th_gen_UserGuide.pdf

  • HT4623 i have a ipod touch 4th gen and i have the wifi bars but when i try to search something it wont let me conect it says "Lightspeed systems - Wed acces" what could i do help please.! o.o

    i have a ipod touch 4th gen and i have the wifi bars but when i try to search something it wont let me conect it says "Lightspeed systems - Wed acces" what could i do help please.! o.o

    Does the iOS device connect to other networks?
    Does the iOS device see the network?
    Any error messages?
    Do other devices now connect?
    Did the iOS device connect before?
    Try the following to rule out a software problem:                 
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    .- Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - Wi-Fi: Unable to connect to an 802.11n Wi-Fi network
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    If still problem make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar

  • Can we limit the search count in Webcenter Imaging on the basis of user/grp

    Hi All
    I have a scenario wherein i want to limit the search count in Webcenter Imaging 11g on the basis of user and group.
    For e.g if administrator searches for documents it should return all the search result, whereas when a noraml business user searches for the document only 1000 documents should be returned as search results(if exact search criteria is not met).
    I am aware of the General setting in Enterprise Manager, but i want to restrict it on the basis of user.
    Can somebody help me, it's really very urgent.
    Thanks
    ACM

    Hi
    This is very important and i am not able to figure a way out of this.
    Is this a Product Feature and can not be altered?
    Please help
    Regards
    ACM

  • I cannot update apps on ipod. Help please.

    So before, i already posted a question about this and i just figured out that it is my internet conection that has the problem, not the ipod.
    It seems that my internet connection or router settings has a problem connecting to my ipod or i don't know... Please help.
    Usually, when there is an app update, a number pops up beside the app store icon, right?
    And when you open the app store:
    WHEN THERE IS AN APP UPDATE - it displays all the apps that needs to be updated
    WHEN THERE'S NONE  - it displays, ALL APPS ARE UP TO DATE.
    My problem is...
    When i connect to the internet at school, it shows the updates or the all apps are up to date when i go to the app store updates tab.
    recently, i leave the update counter (the one beside the app store icon) until i get home so i can be sure there are apps that needs to be updated.
    When i'm home and connect to the internet. Open the app store >updates tab:
    WHEN THERE IS AN APP UPDATE - it keeps on loading.
    WHEN THERE'S NONE  - it keeps on loading.
    And when there's an update counter and i connect to the app store at home, it disappears.
    Please help.. i cannot update my apps on my ipod. There isn't any problem with my device. I just restored it and i started again from scratch. No pictures, music, just apps.
    HELP PLEASE. THANK YOU.

    Please help.. Thank you.

  • Why does my hard drive keep dismounting...help please I am going bonkers...

    Brand new AEBS ver7 firmware
    Works fine on the network and to the gateway for the internet.
    Plug in a Lacie320 drive tot he USB, it sees it, it appears to work (but slow) for a while. Leave it to backup and when I return the disk has dismounted? Gone
    Cant look at logs as I cannot reconnect without rebooting the router at which time the logs all are deleted.
    If I try to reconnect it gives me an error connecting to Airport.
    Only way out is to reboot AEBS.
    If I try to delete files from the hard drive when connected it hangs, computer has timer going round forever message box is open but is not scanning files to delete, it is as if it can't see the drive and is searching...plus it has a small message box I cannot read (half off the screen), only way out of this is a physical reboot (hold power button down for 4 secs)
    Now I have the drive on the USB direct to the machine, works great. So is this a firmware issue on the Airport unit?
    Help please, I have spent days messing around with this and am about to give it up.
    MacBookPro DualCore   Mac OS X (10.4.8)  
    MacBookPro DualCore   Mac OS X (10.4.8)  

    If you look in the iTunes folder on your original hard drive you should find a lot of files named "Temp File". These need to be deleted. I have not figured out what causes these or how to stop them from being made. If anyone knows the answer it would be greatly appreciated. When I delete mine it takes a very long time for them to delete, not the 2 minutes that countdown clock claims!
    Dell 5100   Windows XP  

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • I can't find the imessages app on my ipod touch. can u help please?

    I can't find the imessages app on my ipod touch. can u help please?

    - Try using the Spotlight search. It is likely you just can't find it.
    - Next try a reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears
    - Last, restore the iPod.

Maybe you are looking for