intermediateCollections249 of 436

ArrayList vs Vector?

Tests whether you know Vector is a legacy class that synchronizes every method (making it thread-safe but slower even when uncontended), while ArrayList is unsynchronized by default -- and that Vector's per-method locking still doesn't make compound operations like check-then-add atomic, so it's rarely the right choice over ArrayList plus explicit synchronization or a concurrent collection.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Core Java questions