While working on #31456, I noticed that `AbstractTestContextBootstrapper` often unnecessarily creates instances of `ArrayList` or processes empty lists.