Improve code for moodle verification
This commit is contained in:
parent
cfe533f03b
commit
3f6493694c
1 changed files with 3 additions and 1 deletions
|
@ -37,7 +37,9 @@ public class BracketServer implements CommandExecutor {
|
||||||
for (MatchResult result : results) {
|
for (MatchResult result : results) {
|
||||||
if (bracketPairs.keySet().contains(result.group())) {
|
if (bracketPairs.keySet().contains(result.group())) {
|
||||||
openBrackets.push(result.group());
|
openBrackets.push(result.group());
|
||||||
} else if (result.group().equals(bracketPairs.get(openBrackets.peek()))) {
|
} else if (
|
||||||
|
!openBrackets.isEmpty() &&
|
||||||
|
result.group().equals(bracketPairs.get(openBrackets.peek()))) {
|
||||||
openBrackets.pop();
|
openBrackets.pop();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue