Use isEmpty().
diff --git a/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java b/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
index b5b6ba2..33a6346 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/Subroutines.java
@@ -437,7 +437,7 @@
//Graph colouring. Key: InstructionHandle, Value: ColourConstants enum .
final Map<InstructionHandle, ColourConstants> colors = new HashMap<>();
- final List<InstructionHandle> Q = new ArrayList<>();
+ final List<InstructionHandle> qList = new ArrayList<>();
for (final InstructionHandle actual : sub_leaders) {
// Do some BFS with "actual" as the root of the graph.
// Init colors
@@ -447,8 +447,8 @@
colors.put(actual, ColourConstants.GRAY);
// Init Queue
- Q.clear();
- Q.add(actual); // add(Obj) adds to the end, remove(0) removes from the start.
+ qList.clear();
+ qList.add(actual); // add(Obj) adds to the end, remove(0) removes from the start.
/*
* BFS ALGORITHM MODIFICATION:
@@ -459,19 +459,19 @@
if (actual == all[0]) {
for (final CodeExceptionGen handler : handlers) {
colors.put(handler.getHandlerPC(), ColourConstants.GRAY);
- Q.add(handler.getHandlerPC());
+ qList.add(handler.getHandlerPC());
}
}
/* CONTINUE NORMAL BFS ALGORITHM */
// Loop until Queue is empty
- while (Q.size() != 0) {
- final InstructionHandle u = Q.remove(0);
+ while (!qList.isEmpty()) {
+ final InstructionHandle u = qList.remove(0);
final InstructionHandle[] successors = getSuccessors(u);
for (final InstructionHandle successor : successors) {
if (colors.get(successor) == ColourConstants.WHITE) {
colors.put(successor, ColourConstants.GRAY);
- Q.add(successor);
+ qList.add(successor);
}
}
colors.put(u, ColourConstants.BLACK);