You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Diane Holt <ho...@yahoo.com> on 2002/03/06 02:43:16 UTC

[OT] Java vector question

(Sorry to bug the list, but you're the only Java people I know :)

If I have a Vector v, and I stuff some elements into it (I know they get
in there, because I can print them out with v.firstElement() and
v.lastElement()), shouldn't I be able to get the total number of elements
from v.elementCount?

Thanks!
Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] Java vector question

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message ----- 
From: "Diane Holt" <ho...@yahoo.com>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Tuesday, March 05, 2002 17:43
Subject: [OT] Java vector question


> (Sorry to bug the list, but you're the only Java people I know :)
> 
> If I have a Vector v, and I stuff some elements into it (I know they get
> in there, because I can print them out with v.firstElement() and
> v.lastElement()), shouldn't I be able to get the total number of elements
> from v.elementCount?
> 

public int size()
  Returns the number of components in this vector.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] Java vector question

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Diane Holt wrote:

> (Sorry to bug the list, but you're the only Java people I know :)
> 
> If I have a Vector v, and I stuff some elements into it (I know they get
> in there, because I can print them out with v.firstElement() and
> v.lastElement()), shouldn't I be able to get the total number of elements
> from v.elementCount?
> 


Only if you are extending Vector because this field is protected (which is a bad idea anyway).


Use the size() method instead.

Conor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] Java vector question

Posted by Derek Slager <de...@activate.net>.
On Tue, Mar 05, 2002 at 05:43:16PM -0800, Diane Holt wrote:
> (Sorry to bug the list, but you're the only Java people I know :)

Please consider asking your question (and other Java questions unrelated to
Ant development) in the JDC forums:

 http://forum.java.sun.com/

You might also benefit from the information here:

 http://developer.java.sun.com/developer/infodocs/

Good luck,

-- 
Derek Slager
Software Engineer
Activate
derek@activate.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>