Skip to content

Commit

Permalink
8311517: Add performance information to ArrayList javadoc
Browse files Browse the repository at this point in the history
Reviewed-by: smarks, bpb
  • Loading branch information
danthe1st authored and Stuart Marks committed Aug 4, 2023
1 parent b2add96 commit b463c6d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/java.base/share/classes/java/util/ArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
* {@code Vector}, except that it is unsynchronized.)
*
* <p>The {@code size}, {@code isEmpty}, {@code get}, {@code set},
* {@code iterator}, and {@code listIterator} operations run in constant
* time. The {@code add} operation runs in <i>amortized constant time</i>,
* that is, adding n elements requires O(n) time. All of the other operations
* run in linear time (roughly speaking). The constant factor is low compared
* to that for the {@code LinkedList} implementation.
* {@code getFirst}, {@code getLast}, {@code removeLast}, {@code iterator},
* {@code listIterator}, and {@code reversed} operations run in constant time.
* The {@code add}, and {@code addLast} operations runs in <i>amortized
* constant time</i>, that is, adding n elements requires O(n) time. All of
* the other operations run in linear time (roughly speaking). The constant
* factor is low compared to that for the {@code LinkedList} implementation.
*
* <p>Each {@code ArrayList} instance has a <i>capacity</i>. The capacity is
* the size of the array used to store the elements in the list. It is always
Expand Down

1 comment on commit b463c6d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.