Difference between ArrayList and Vector

Posted By: Unknown - 11:21 PM
ArrayList it's part of the Java Collection Framework, and has been added with version 1.2, while Vector it's an object that is present since the first version of the JDK. Vector, anyway, has been retrofitted to implement the List interface.

ArrayList is not thread-safe whereas Vector is thread-safe (Synchronized). In Vector class each method like add(), get(int i) is surrounded with a synchronized block and thus making Vector class thread-safe.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.