Re: Issue With ArrayList
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 07 Nov 2008 09:38:04 -0800
On Thu, 6 Nov 2008 22:08:57 -0800 (PST), jagadesh
<jagadesh.manchala@xxxxxxxxx> wrote, quoted or indirectly quoted
someone who said :
ArrayList my=new ArrayList(10);
works faster that ArrayList my=new ArrayList(10);
I think you meant:
ArrayList my = new ArrayList(10);
works faster than
ArrayList my = new ArrayList();
That is not true.
However:
ArrayList my = new ArrayList(100);
works faster than
ArrayList my = new ArrayList();
If you have 100 elements. However if you have only 10, then
ArrayList my = new ArrayList();
works faster.
new ArrayList() is just shorthand for new ArrayList(10).
They have exactly the same meaning.
Normally you specify the content type e.g.
ArrayList<String> my = new ArrayList<String>(100);
--
Roedy Green Canadian Mind Products
http://mindprod.com
Your old road is
Rapidly agin'.
Please get out of the new one
If you can't lend your hand
For the times they are a-changin'.
.
- Follow-Ups:
- Re: Issue With ArrayList
- From: jagadesh
- Re: Issue With ArrayList
- References:
- Issue With ArrayList
- From: jagadesh
- Issue With ArrayList
- Prev by Date: Re: Serialization Slow?
- Next by Date: Generics and for each
- Previous by thread: Re: Issue With ArrayList
- Next by thread: Re: Issue With ArrayList
- Index(es):
Relevant Pages
|