Results 1 to 3 of 3
Thread: Search a object in a vector
- 04-30-2008, 12:16 PM #1
Member
- Join Date
- Mar 2008
- Posts
- 2
- Rep Power
- 0
Search a object in a vector
Hi,
I am supposed to see whether an object of a class (not Object class) is already in vector containing some objects of same class.
for example:
I have a class "Edge" having a sourceNode and targetNode.
I am storing the instances of this class in an vector but before storing I need to know whether the new instance already exists in the vector or not?(edge with same source and target node)
Can anyone let me know how can i do it?
Thanks
- 04-30-2008, 01:42 PM #2
You can use contains(Object o) method to test if that is already exists....
Or you can start to read here for more understandable details,
regards,
sukatoafreedom exists in the world of ideas
- 04-30-2008, 02:05 PM #3
You can also use java.util.TreeSet<E>. It does it all at once for you :)
Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
[SOLVED] If a object equals another object, do they contain the same data?
By bobleny in forum New To JavaReplies: 1Last Post: 04-17-2008, 10:10 PM -
URGENT: Sorting a vector of object by an element
By doobybug in forum New To JavaReplies: 1Last Post: 03-12-2008, 06:37 PM -
Vector help
By king_arthur in forum New To JavaReplies: 3Last Post: 01-22-2008, 07:33 PM -
Creating object of Type Object class
By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks