Modernize collections

Proprietary

Replace the legacy synchronized types Hashtable, Vector, Stack, and StringBuffer with their modern unsynchronized counterparts HashMap, ArrayList, Deque/ArrayDeque, and StringBuilder. Each replacement is only applied when program analysis shows the instance is a local variable that never leaves its method and is used only in ways its replacement supports, so the synchronization it provided is redundant.

io.moderne.staticanalysis.ModernizeCollections
mod run . --recipe=io.moderne.staticanalysis.ModernizeCollections

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Replace java.util.Hashtable with java.util.HashMap
  2. Replace java.util.Vector with java.util.ArrayList
  3. Replace java.util.Stack with java.util.Deque
  4. Replace java.lang.StringBuffer with java.lang.StringBuilder