For collections etc., I suggest you have a look at the Java Tutorials about collections.
Note there are several kinds of collection, Lists Sets and Maps being the most popular. You are confusing Lists and Sets in what you posted.
Yes, you can set up a List or a Set of Dates, but the two are different: Lists can contain duplicates of the same value and Lists are ordered (the first object added is at the beginning and the last at the end). You can set up an object to hold two Dates, too. It all depends what you want to do with them. You can have a Set:You can have a List:Or you can have an object whihc has two dates in:Read the link I qouted and see how you get on with that. CR
Joined: Mar 25, 2008
Thanks guys very much for your time
I understand the difference between Set & List, and my program should not allow two objects of type SomeObject (as in the previous code) to have the same dates...
And so i guess i need to create SomeObject class
I really appreciate it Thanks again
Joined: Oct 13, 2005
Originally posted by Amy Dickens: Thanks guys very much . . . my program should not allow two objects . . .to have the same dates
If you want to make sure there are two different dates, make the date object override the equals method, then put a test in the constructor of TwoDates which throws an Exception if the two are equal. You might even want to create a SameDateException.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com