Results 1 to 8 of 8

Thread: Java qyestion (should be easy)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Java qyestion (should be easy)

    Have you checked the Java tutorial on collections?

    http://java.sun.com/docs/books/tutor...ons/index.html


    Coding in eclipse (free) can help catch syntax errors (it underlines them in red as you type, just like word )

    http://www.eclipse.org/

  2. #2

    Default Re: Java qyestion (should be easy)

    Fekking logged me out, after I finished writing a long post.

    Anyways, real quick as I don't have the time to type it out again, perhaps tonight if I can get a minute.

    Try
    boolean contains(Object elem)
    Tests if the specified object is a component in this vector.
    In the api that Drone linked too. That method looks like what you are looking for.
    ..::Noobs don't own themselves!::..

  3. #3
    Needs more flowers Moderator drone's Avatar
    Join Date
    Dec 2004
    Location
    Moral High Grounds
    Posts
    9,286

    Default Re: Java qyestion (should be easy)

    Reading through the Vector page, looks like Java vectors are similiar to arrays of void pointers in C. Any class object can be added to a vector. Is this correct?

    If so, can you use the getClass() method to do what you want? Verify the class then cast appropriately to remove the compile problems?
    The .Org's MTW Reference Guide Wiki - now taking comments, corrections, suggestions, and submissions

    If I werent playing games Id be killing small animals at a higher rate than I am now - SFTS
    Si je n'étais pas jouer à des jeux que je serais mort de petits animaux à un taux plus élevé que je suis maintenant - Louis VI The Fat

    "Why do you hate the extremely limited Spartan version of freedom?" - Lemur

  4. #4
    Member Member Phatose's Avatar
    Join Date
    Dec 2003
    Location
    PA, USA
    Posts
    591

    Default Re: Java qyestion (should be easy)

    Should be able to use a generic for this.

    Vector <String> myVector;
    Last edited by Phatose; 03-08-2006 at 08:02.

  5. #5
    zombologist Senior Member doc_bean's Avatar
    Join Date
    Oct 2004
    Location
    Riding Shai-Hulud
    Posts
    5,346

    Default Re: Java qyestion (should be easy)

    Quote Originally Posted by Phatose
    Should be able to use a generic for this.

    Vector <String> myVector;
    Yes ! This was what i was looking for. Muchos Gracias !
    Yes, Iraq is peaceful. Go to sleep now. - Adrian II

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO