mirror of
https://github.com/twitter/the-algorithm.git
synced 2025-01-02 23:51:53 +01:00
feat: reduce duplication in BasicIndexingConverter
This commit is contained in:
parent
eaeb4bc1d8
commit
97fd2dc821
@ -560,10 +560,11 @@ public class BasicIndexingConverter {
|
||||
long inReplyToUserIdVal,
|
||||
boolean strict,
|
||||
EarlybirdThriftDocumentBuilder builder) {
|
||||
Optional<Long> retweetUserId = Optional.of(retweetUserIdVal).filter(id -> id > 0);
|
||||
Optional<Long> sharedStatusId = Optional.of(sharedStatusIdVal).filter(id -> id > 0);
|
||||
Optional<Long> inReplyToUserId = Optional.of(inReplyToUserIdVal).filter(id -> id > 0);
|
||||
Optional<Long> inReplyToStatusId = Optional.of(inReplyToStatusIdVal).filter(id -> id > 0);
|
||||
Predicate<Long> isGreaterThanZero = id -> id > 0;
|
||||
Optional<Long> retweetUserId = Optional.of(retweetUserIdVal).filter(isGreaterThanZero);
|
||||
Optional<Long> sharedStatusId = Optional.of(sharedStatusIdVal).filter(isGreaterThanZero);
|
||||
Optional<Long> inReplyToUserId = Optional.of(inReplyToUserIdVal).filter(isGreaterThanZero);
|
||||
Optional<Long> inReplyToStatusId = Optional.of(inReplyToStatusIdVal).filter(isGreaterThanZero);
|
||||
|
||||
Preconditions.checkState(retweetUserId.isPresent() == sharedStatusId.isPresent());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user