Multiple types in Vector - type checking
Hi all.
I've got a Vector that can hold two types of object - either a standard String or a dataHolder object that contains a string and has it's own to string method. (The reason is that the vector holds a list of addresses as strings - the dataHolder is a mutable string object that allows modifcation of the addresses).
The problem is the type checking. If I use Vector<String> myVector the compiler won't accept the data holder object. If I use Vector<dataHolder> the compiler won't accept Strings.
Is there a way to tell the compiler that the vector can contains either a string or a dataholder object?