Replace java.util.Vector with java.util.ArrayList
ProprietaryVector synchronizes every operation, which only costs time when a single thread uses it. This recipe replaces a Vector that a method creates and keeps in a local variable with an ArrayList when program analysis shows that no other thread can reach it or a view of it such as its subList(..): neither is returned, stored in a field, passed to another method or constructor, or captured by a lambda that may run later or on another thread, by any path through the method, loops and catch blocks included. A list whose Vector-only methods (such as elementAt or addElement) are called, the Vector(int, int) constructor, fields, and Kotlin and other non-Java source are left as they are.
io. moderne. staticanalysis. ReplaceVectorWithArrayListmod run . --recipe= io. moderne. staticanalysis. ReplaceVectorWithArrayListInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.