Replace outdated Java collections (#508)

This commit is contained in:
Sam Carlberg
2019-08-27 01:47:18 -04:00
committed by Peter Johnson
parent 8993ce5bf1
commit 4b2b21d247
5 changed files with 23 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -8,8 +8,8 @@
package edu.wpi.first.wpilibj.test;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -37,7 +37,7 @@ public abstract class AbstractTestSuite {
*/
protected List<Class<?>> getAnnotatedTestClasses() {
SuiteClasses annotation = getClass().getAnnotation(SuiteClasses.class);
List<Class<?>> classes = new Vector<Class<?>>();
List<Class<?>> classes = new ArrayList<>();
if (annotation == null) {
throw new RuntimeException(String.format("class '%s' must have a SuiteClasses annotation",
getClass().getName()));
@@ -77,7 +77,7 @@ public abstract class AbstractTestSuite {
}
protected List<ClassMethodPair> getMethodMatching(final String regex) {
List<ClassMethodPair> classMethodPairs = new Vector<ClassMethodPair>();
List<ClassMethodPair> classMethodPairs = new ArrayList<>();
// Get all of the test classes
for (Class<?> c : getAllContainedBaseTests()) {
for (Method m : c.getMethods()) {
@@ -136,7 +136,7 @@ public abstract class AbstractTestSuite {
* @return The list of base test classes.
*/
public List<Class<?>> getAllContainedBaseTests() {
List<Class<?>> runningBaseTests = new Vector<Class<?>>();
List<Class<?>> runningBaseTests = new ArrayList<>();
return getAllContainedBaseTests(runningBaseTests);
}
@@ -167,7 +167,7 @@ public abstract class AbstractTestSuite {
* @return The list of classes matching the regex pattern
*/
public List<Class<?>> getAllClassMatching(final String regex) {
final List<Class<?>> matchingClasses = new Vector<Class<?>>();
final List<Class<?>> matchingClasses = new ArrayList<>();
return getAllClassMatching(regex, matchingClasses);
}
@@ -226,7 +226,7 @@ public abstract class AbstractTestSuite {
* @return the list of suite and/or test classes matching the regex.
*/
protected List<Class<?>> getSuiteOrTestMatchingRegex(final String regex) {
final List<Class<?>> matchingClasses = new Vector<Class<?>>();
final List<Class<?>> matchingClasses = new ArrayList<>();
return getSuiteOrTestMatchingRegex(regex, matchingClasses);
}
@@ -248,7 +248,7 @@ public abstract class AbstractTestSuite {
* @throws RuntimeException If the <code>@SuiteClasses</code> annotation is missing.
*/
public List<String> getAllClassName() {
List<String> classNames = new Vector<String>();
List<String> classNames = new ArrayList<>();
for (Class<?> c : getAnnotatedTestClasses()) {
classNames.add(c.getName());
}