Class VectorExample
java.lang.Object
topics.foundation.structures.VectorExample
Legacy Thread-Safe Vector Demonstration
Demonstrates the structural operations of a Vector, a legacy
collection acting as a synchronized, dynamically resizing array.
Architectural Note: Because all of its core mathematical operations
are globally synchronized, Vector incurs a notable thread-locking
performance overhead. Modern architectural standards heavily favor unsynchronized
dynamic arrays for single-threaded contexts, or specialized concurrent structures
for multi-threaded environments.
Complexity
- Time Complexity:
O(1)amortized for appending an element to the tail.O(N)for indexed insertions or value-based removals, as the underlying elements must be shifted in memory.
- Space Complexity:
O(N)to maintain the contiguous backing array, which doubles in capacity upon saturation by default.
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
VectorExample
public VectorExample()
-
-
Method Details
-
main
Main execution entry point.- Parameters:
args- Command-line arguments (not utilized).
-