ArrayList like a like a lot Java classes (e.g. java.io.*) needlessly make useful internal varables private when they should have been protected, so making sub-classes less useful. The private array in ArrayList forced me to use Vector instead, to make an efficient ordered list e.g. Vector sort takes N*Log2(N) iterations,. Arraylist sort takes 2N*Log2(N) iterations (assuming quicksort)
e.g. Vector binary search takes at most Log2(N) iterations, Arraylist linear search takes at most N iterations. i.e. IMHO ArrayList is broken.
Yes I could use a map, but it isn't always the best solution e.g. can use more memory and be slower. |