Hi, i am learning Java and i need to make a little program that gets a text file and search for duplicate lines in it. The lines in the text file look like this : 2004-12-19 00:00:00.000,105,19:57:26,INI,DISCANDO INTRANET 2004-12-19 00:00:00.000,105,19:57:26,INI,DISCANDO INTRANET
Do you want to display duplicates or eliminate them? I started out thinking eliminate, but it's hard to tell from your question.
If duplicates appear next to each other, something like this will copy a file and remove duplicate lines:
If duplicates could appear anywhere, look into the Collections APIs to find one that doesn't store duplicates or one you could ask if a line already exists. Here's my Collections Crib Sheet that may help.
Let us know what you choose! [ December 20, 2004: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Dec 20, 2004
Thanks for the tip. I would like to remove the duplicated lines. I will let you know when i finish it.