On Sunday, July 6, 2003, at 05:01 PM, Joe Eugene wrote:

ColdFusion arrays are Java Vectors, am not sure why this is done this
way in CFMX cause
the preferred Java Collection for Dyanamic Arrays are ArrayList Java
Collection Objects.

I'm guessing they are Vectors because ArrayLists are not synchronized, which means they would require locking. Vectors, on the other hand, are synchronized, so they do not require locking which makes them easier to work with. Vectors are probably used for the same reason Hashtables are used for variable scopes rather than HashMaps. Below is an excerpt from the documentation on ArrayLists:


"Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList method. This is best done at creation time, to prevent accidental unsynchronized access to the list."

Christian

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to