473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

what's the difference between array and arraylist

Hei
Hi all

(as subject)

Hei.
Nov 20 '05 #1
6 15339
Hi,

There are several differences, but the biggest, in my opinion, is that an
arraylist grows as you add items to it and does not have to be redimmed the
allow additional elements. Arraylists are sortable, searchable, etc - they
are far superior to arrays.

HTH,

Bernie Yaeger

"Hei" <ch******@msn.com> wrote in message
news:Ol*************@TK2MSFTNGP11.phx.gbl...
Hi all

(as subject)

Hei.

Nov 20 '05 #2
Cor
Hi Hei,

In additon to Bernie,

When you have a fixed array, there is in use no difference.
(And the old array is than very simple to make).

When you have to do something else with the array than read from it, use
everything else than the old array by example the arraylist.

I hope that this helps a little bit?

Cor
Nov 20 '05 #3
* "Hei" <ch******@msn.com> scripsit:
[...]

Arrays cannot be changed in size at runtime (except using 'ReDim' which
will create a new array, copy the old array in the new array and destroy
the old array). The arraylist is more dynamic, you can add and remove
items without loosing performance.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "Hei" <ch******@msn.com> scripsit:
[...]

Arrays cannot be changed in size at runtime (except using 'ReDim'
which will create a new array, copy the old array in the new array
and destroy the old array).


.... if 'ReDim' is followed by a 'Preserve'
--
Armin

Nov 20 '05 #5
* "Armin Zingler" <az*******@freenet.de> scripsit:
Arrays cannot be changed in size at runtime (except using 'ReDim'
which will create a new array, copy the old array in the new array
and destroy the old array).


... if 'ReDim' is followed by a 'Preserve'


Thanks, that's needed in order to get the same behavior as with the
arraylist.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "Armin Zingler" <az*******@freenet.de> scripsit:
Arrays cannot be changed in size at runtime (except using
'ReDim' which will create a new array, copy the old array in the
new array and destroy the old array).


... if 'ReDim' is followed by a 'Preserve'


Thanks, that's needed in order to get the same behavior as with
the arraylist.

;-)


That's also needed when you want the behavior you described with the array.
--
Armin

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bad_Kid | last post by:
arraylist / array ??? what is better for what?
8
by: xmail123 | last post by:
Hi, As was pointed out whatever you return from a WebMethod needs to be serializable to SOAP. An ArrayList is not serializable. I will be needing to return other data types from web methods. ...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
1
by: Alan Silver | last post by:
Hello, I have a page in which I'm trying to give the user the chance to manipulate a list of items. These are the price variations for a product, so each item consists of a name (eg, small,...
9
by: Steve | last post by:
Hello, I created a structure ABC and an array of type ABC Public Structure ABC Dim str1 As String Dim int1 As Integer End Structure Public ABC1 As New ABC, ABC2 As New ABC
18
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point...
3
by: AppleBag | last post by:
I'm new to the vb.net scene, (from vb6) and would appreciate if someone could explain the difference between the two? From all I've read they seem to be the exact same thing? And as an expansion...
2
by: shini | last post by:
What is the difference between an array and arraylist in java?Also specify the difference between a String and StringBuffer?
38
by: Zytan | last post by:
What is the difference between these two lines? Dim args As Object() = New Object() {strText} Dim args As Object() = {strText} args seems usuable from either, say, like so: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.