mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Merge pull request #43 from DanilaFe/java8-subset
Replace some recent android API features with backwards compatible ones.
This commit is contained in:
commit
08e5b69c04
|
@ -79,10 +79,10 @@ public class Lexer<T> {
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
matches.sort((a, b) -> compare.compare(a.getType(), b.getType()));
|
|
||||||
if (compare != null) {
|
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);
|
return matches.isEmpty() ? null : matches.get(matches.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,10 @@ public class Lexer<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(name, id);
|
return Arrays.hashCode(new Object[] {
|
||||||
|
this.name,
|
||||||
|
this.id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class LexerTokenizer implements Tokenizer<Match<TokenType>>, PluginListen
|
||||||
/**
|
/**
|
||||||
* Comparator used to sort the tokens produced by the lexer.
|
* 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.
|
* The lexer instance used to turn strings into matches.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user