I want to create a method to eliminate duplicates from a text file.
Edit: Why am i getting downvoted ? It's not like I didn't search through the web before asking.
For example, the data in the text file:
Fruits:Edible:Inedible
Apple:5:10
Apple:1:2
Pear:5:1
Orange:20:1
Pear:5:1
Apple:5:10
Orange:1:20
Orange:20:1
I have a class of apple, orange, pear according to this example. Using the class, I have created 3 different object vector to store them in, using set methods.
For example if Apple
is detected:
Apple.setedible(Edible);
Apple.setinedible(Inedible);
I can currently store them nicely into their object vectors which will result in this:
In Apple vector:
5:10
1:2
5:10
In Orange Vector:
20:1
1:20
20:1
In Pear Vector:
5:1
5:1
I want to eliminate the duplicates base on edible
and inedible
and I have no idea on how am I going to eliminate them which will result me in:
In Apple vector:
5:10
1:2
In Orange Vector:
20:1
1:20
In Pear Vector:
5:1
Please advise.