Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Java Vector - Help
11-03-2008, 02:13 PM #1
- Join Date
- Nov 2008
- Thanked 0 Times in 0 Posts
Java Vector - Help
I was wondering if any of the Gurus here could explain the following:
I have read quite a few old O'reilly Java books that my friend lent to me.
I was wondering why the way of creating a Vector object has changed?
Can anyone explain this to me... Probably a basic question but I was just wondering, cause it caused a problem with one of my Apps.
11-03-2008, 04:14 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,659 Times in 2,628 Posts
OMG it changed? When?
The only way I've known is a standard constructing. I think it may be overloaded, but I've never used anything but the default constructor. That and generics which started in version 5.
The only difference is generics *can* take an object type:
The generics really help though, now I don't need to typecast my result since I know it will be a string (the first one can only hold string, nothing else).PHP Code:
Vector<String> stringVector = new Vector<String>();
// Versus old:
Vector stringVector = new Vector();
Is this what you mean by the change, or is there another type of change I've missed out on? Generics are quite frequent in java classes now, most of the collections allow them as well as comparable interfaces. Generics are the single best feature. Ever. After pointers. :P.
header('HTTP/1.1 420 Enhance Your Calm');