Use the appropriate data structure for the appropriate scenario. I have only used Stack when doing formula calculations, but I rarely use it at other times and it has no impact. So it still depends on your business scenario, and you should use it.
Not recommended The advantage is thread safety, so single-threaded ArrayList and the like are better. However, when multi-threading is needed, there are Collections.synchronizedList and the java.util.concurrent package. So forget about this thing.
Use the appropriate data structure for the appropriate scenario.
I have only used Stack when doing formula calculations, but I rarely use it at other times and it has no impact. So it still depends on your business scenario, and you should use it.
Not recommended
The advantage is thread safety, so single-threaded ArrayList and the like are better.
However, when multi-threading is needed, there are Collections.synchronizedList and the java.util.concurrent package. So forget about this thing.
When the sample size of computationally intensive code is small, the accidental error of performance testing is relatively large