How to run methods in benchmarks sequentially with JMH?
问题 In my scenario, the methods in benchmark should run sequentially in one thread and modify the state in order. For example, there is a List<Integer> called num in the benchmark class. What I want is: first, run add() to append a number into the list. Then, run remove() to remove the number from the list. The calling sequence must be add() --> remove() . If remove() runs before add() or they run concurrently, they would raise exceptions because there's no element in the list. That is, add() and