February 2007

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28      
Blog powered by Typepad

« Link Updates | Main | Getting the Array »


Joe G.

Are there any paralells between ArrayLists and a Pascal Linked List? Seem similar on the surface (array size is not defined at compile time).

Brian Tyler

An ArrayList isn't a link listed - different data structure, although both are linear structures. It is funny that for two things that seem so similar, they are used in very different situations...

Link Lists have very fast insert and delete, but linear time lookup. ArrayLists are terrible at inserts (even at the end if you have to resize) but constant time for lookup.

What is also interesting is that there is no Linked List class in .NET 1.x. You have to wait until .NET 2.0 to get it.

Eugene Geno

One thing to remember though, arryalist being part of the system.collection namespace, it can not be serialized. You can use arraylist.copyto(array) method to copy all the elemements of an arraylist to an array and have all the advantages of an array(fast read, serialization etc).

Brian Tyler

Actually, that isn't correct. Many classes, including ArrayList, are marked with the serializable attribute. Of course, for the list to be truly serializable, elements you put in must also be serializable.


You are right, i think that using arrays instead of arraylists when possible can improve performance significantly.

hwtjkfigc qapgfx

sodxcg lqign hzmvse xtehlbgkp jwzdup dqyev blkvfmg


"If you create an array, you must say up front how large the array is going to be. Once picked, you can't change it."

Wrong, yu simply "Re Dim Preserve" to expand an array.

Further more, if the function that populates an array is a standard NET function (writeallfiles for example) if will auto-size the array for you without you having to state up front what the array size is.

for example (imports system.IO)

Dim array() As String

array = File.ReadAllLines("C:\text.txt")

would make the array the size its needs to be to incorporate all lines


Redim Preserve should be avoided. If a dynamic array is needed, it is better to just use an ArrayList.

And the internal working of the ReadAllLines method might just be using an ArrayList to read the file and do a ToArray() at the end...

new jordans

The blog article very surprised to me! Your writing is good. In this I learned a lot! Thank you!

cheap air yeezy

To sensible men, every day is a day of reckoning..

Coach Wristlets

They say every dog has his day and this dog had his today~

Hobo Handbags

These particles of light are the fastest things in the universe, so an optical computer could theoretically process information at speeds that make even a supercomputer look glacial.

JP@arraylist in java

Great article and you have indeed covered the topic quite well I have also blogged about Java Arraylist in Java 5 some time back , may be you find interesting.

Account Deleted

Thanks for your post! The only difference is that ArrayList is scalable. But I think it's worth to notice that when simple array is created an abstract class Array is created and it also implements IEnumerable, ICollection and IList interfaces as it is ArrayList does.

The comments to this entry are closed.