Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Location
    UK
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Java Vector - Help

    Hi there,

    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.

    Andy

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    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:
    PHP Code:
    Vector<StringstringVector = new Vector<String>();
    // Versus old:
    Vector stringVector = new Vector(); 
    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).

    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.

    Edit:
    And structs.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •