1.5 headaches with generics


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: 1.5 headaches with generics

  1. #1
    Join Date
    Mar 2004
    Posts
    635

    1.5 headaches with generics

    Now with Tiger, this is how I have to create my Vector for my JTable.

    Vector<String> columns = new Vector<String>();

    But the data Vector is a Vector of Vectors, and I don't know how the syntax should look for that. Plus, this new method of using generic types allows me to only have 1 type of object in the Vector. Previously, a row of data in my table would look like this:
    Code:
    MP3, String, String, String
    When the user double clicked a row, I would get the MP3 object and use its methods to get the path of where the real file is stored. I did not want to display the whole pathname in my table. Anyone help me out here?

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    isn't it possible to declare you Vector as followed:

    Vector<Object> myVector = new Vector();

    Using the most basic Object class should allow you to put most anything in there.

  3. #3
    Join Date
    Mar 2004
    Posts
    635
    hey, good point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center