Skip to content

Commit 5dd6d52

Browse files
committed
Vector class more tests
1 parent 64b205a commit 5dd6d52

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎core-java-collections/src/main/java/com/baeldung/performance/ArrayListBenchmark.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public boolean testContains(ArrayListBenchmark.MyState state) {
4949
return state.employeeList.contains(state.employee);
5050
}
5151

52+
@Benchmark
53+
public boolean testContainsVector(ArrayListBenchmark.MyState state) {
54+
return state.employeeVector.contains(state.employee);
55+
}
56+
5257
@Benchmark
5358
public int testIndexOf(ArrayListBenchmark.MyState state) {
5459
return state.employeeList.indexOf(state.employee);
@@ -73,6 +78,11 @@ public void testAdd(ArrayListBenchmark.MyState state) {
7378
state.employeeList.add(new Employee(state.iterations + 1, "John"));
7479
}
7580

81+
@Benchmark
82+
public void testAddVector(ArrayListBenchmark.MyState state) {
83+
state.employeeVector.add(new Employee(state.iterations + 1, "John"));
84+
}
85+
7686
public static void main(String[] args) throws Exception {
7787
Options options = new OptionsBuilder()
7888
.include(ArrayListBenchmark.class.getSimpleName()).threads(1)

0 commit comments

Comments
 (0)