mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-17 08:03:09 -08:00
Replace some recent android API features with backwards compatible ones.
This commit is contained in:
parent
378ff946d9
commit
6a0b667c32
|
@ -79,10 +79,10 @@ public class Lexer<T> {
|
|||
|
||||
index++;
|
||||
}
|
||||
matches.sort((a, b) -> compare.compare(a.getType(), b.getType()));
|
||||
if (compare != null) {
|
||||
matches.sort(Comparator.comparingInt(a -> a.getContent().length()));
|
||||
Collections.sort(matches, (a, b) -> compare.compare(a.getType(), b.getType()));
|
||||
}
|
||||
Collections.sort(matches, (o1, o2) -> o1.getContent().length() - o2.getContent().length());
|
||||
return matches.isEmpty() ? null : matches.get(matches.size() - 1);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,10 @@ public class Lexer<T> {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, id);
|
||||
return Arrays.hashCode(new Object[] {
|
||||
this.name,
|
||||
this.id
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LexerTokenizer implements Tokenizer<Match<TokenType>>, PluginListen
|
|||
/**
|
||||
* Comparator used to sort the tokens produced by the lexer.
|
||||
*/
|
||||
protected static final Comparator<TokenType> TOKEN_SORTER = Comparator.comparingInt(e -> e.priority);
|
||||
protected static final Comparator<TokenType> TOKEN_SORTER = (o1, o2) -> o1.priority - o2.priority;
|
||||
|
||||
/**
|
||||
* The lexer instance used to turn strings into matches.
|
||||
|
|
Loading…
Reference in New Issue
Block a user