But then Geert.. which one is the faster .. Arrays or
Vectors.. and why?

Thanks in advance,

Venu

--- Geert Van Damme <[EMAIL PROTECTED]> wrote:
> If that's true, your boss is stupid.
>
> Java costs memory and time too, why don't you use
> assembler?
> Most probably, the time it took you (and the $) is
> much higher than the
> aggregated difference between sing a vector and an
> array will ever be.
> That's why this is absolutely stupid!
>
> If I program 1 hour to gain a millisecond, it takes
> 3.600.000 runs of the
> function before there's any gain.
> 1 hour is nothing.
> 3.600.000 is a lot ;-)
>
>
> Geert Van Damme
>
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages
> specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of
> Shirley Chen
> > Sent: woensdag 20 december 2000 22:11
> > To: [EMAIL PROTECTED]
> > Subject: Re: arrays
> >
> >
> > Thanks for replying.  But my boss insists that I
> use array because vector
> > costs more memory and time.
> >
> >
> >
> > >From: Shawn Zhu <[EMAIL PROTECTED]>
> > >Reply-To: A mailing list about Java Server Pages
> specification and
> > >     reference <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: arrays
> > >Date: Wed, 20 Dec 2000 13:06:06 -0800
> > >
> > >Why don't you just use Vector?
> > >--------
> > >Vector v_queryResult = New Vector();
> > >...
> > >if(tmpString.indexOf('C')!=-1)
> > >{
> > >
> v_queryResult.addElement((Object)tmpString);
> > >}
> > >--------
> > >Then there's no need for Array2.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Shirley Chen
> [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, December 20, 2000 11:39 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: arrays
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have a question, somebody please help me:
> > > >
> > > > I have a vector which will keep all the names
> the user typed
> > > > in.  Then the
> > > > user supposes can do a query like "give me all
> the name which
> > > > starts with
> > > > 'C'".  In order to do that, I do something
> like this:
> > > >
> > > > ...
> > > > String[] array1 = new String[myVector.size()];
> > > > String tempString = "";
> > > > int j=0;
> > > >
> > > > for (int i=0; i<myVector.size(); i++)
> > > > {
> > > >    tmpString = (String)myVector.get(i);
> > > >    if (tmpString.indexOf('C') != -1)
> > > >       {
> > > >         array1[j] = tmpString;
> > > >         j++;
> > > >       }
> > > > }
> > > >
> > > > //since array1 may not be filled up with data,
> I transfer it
> > > > to another
> > > > String array so I know how many element in the
> array
> > > >
> > > > String array2 = new String[j];
> > > > for (int i=0; i<j; i++)
> > > > {
> > > >    array2[i] = array1[i];
> > > > }
> > > >
> > > > // then I will do display. Supposedly, say,
> array2.length is
> > > > 20, if the user
> > > > wants to display first 5, I will display only
> the first 5
> > > > records, if the
> > > > user wants to display 30, and I will display
> 20 instead.
> > > > ...
> > > >
> > > > I can display all the situations ok except
> when myVector
> > > > contains the names
> > > > that all start with "C" (which means
> array2.length should be
> > > > myVector.size()). then the program will crash.
>  I think it
> > > > might be array
> > > > out of bound problem, but I don't know how to
> fix it. Please help me.
> > > >
>
_________________________________________________________________
> > > > Get your FREE download of MSN Explorer at
> http://explorer.msn.com
> > > >
> > > >
>
==============================================================
> > > > =============
> > > > To unsubscribe: mailto [EMAIL PROTECTED]
> with body:
> > > > "signoff JSP-INTEREST".
> > > > For digest: mailto [EMAIL PROTECTED] with
> body: "set
> > > > JSP-INTEREST DIGEST".
> > > > Some relevant FAQs on JSP/Servlets can be
> found at:
> > > >
> > > >  http://java.sun.com/products/jsp/faq.html
> > > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > > >
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > >
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > > >
> > >
> >
>
>=================================================================
> > ==========
> > >To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> > >JSP-INTEREST".
> > >For digest: mailto [EMAIL PROTECTED] with
> body: "set JSP-INTEREST
> > >DIGEST".
> > >Some relevant FAQs on JSP/Servlets can be found
> at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
_________________________________________________________________
> > Get your FREE download of MSN Explorer at
> http://explorer.msn.com
> >
> >
>
==================================================================
> > =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with
> body: "set
> > JSP-INTEREST DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found
> at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to