diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-03-27 23:08:03 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-03-27 23:08:03 +0100 |
| commit | 623e03b9b557b24304641e6f2a73907622738c3d (patch) | |
| tree | 391450a508c92f1cdfc3ca06425e0c8194b639ba /src/main | |
| parent | 093d300d51d8b07435766c1d127b14ac02a0c25a (diff) | |
Replace null check with isNull
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/internal/styles/parsing/RegexTokeniser.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/zwobble/mammoth/internal/styles/parsing/RegexTokeniser.java b/src/main/java/org/zwobble/mammoth/internal/styles/parsing/RegexTokeniser.java index 7ae24c0..4386e0a 100644 --- a/src/main/java/org/zwobble/mammoth/internal/styles/parsing/RegexTokeniser.java +++ b/src/main/java/org/zwobble/mammoth/internal/styles/parsing/RegexTokeniser.java @@ -6,6 +6,7 @@ import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static java.util.Objects.isNull; import static org.zwobble.mammoth.internal.util.Iterables.*; import static org.zwobble.mammoth.internal.util.Lists.eagerMap; @@ -42,7 +43,7 @@ public class RegexTokeniser<T> { Matcher matcher = pattern.matcher(value); List<Token<T>> tokens = new ArrayList<>(); while (matcher.lookingAt()) { - Optional<Integer> groupIndex = tryFind(intRange(0, this.rules.size()), index -> matcher.group(index + 1) != null); + Optional<Integer> groupIndex = tryFind(intRange(0, this.rules.size()), index -> !isNull(matcher.group(index + 1))); if (groupIndex.isPresent()) { T tokenType = this.rules.get(groupIndex.get()); tokens.add(new Token<>(matcher.regionStart(), tokenType, matcher.group())); |
