Guava ComparisonChain - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava ComparisonChain class.

This code example shows how to use the following methods:compare, result
        @Override 
        public int compareTo(FifoRunnableTask<T> other)
        { 
            return ComparisonChain.start()
                    .compare(this.task, other.task, taskComparator)
                    .compare(this.sequenceNumber, other.sequenceNumber)
                    .result();
        } 
 
        @Override 
        public boolean equals(Object o)
        { 
            if (this == o) {
                return true; 
            } 
            if (o == null || getClass() != o.getClass()) {
                return false; 
            } 
 
            FifoRunnableTask<?> other = (FifoRunnableTask<?>) o;
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compare, result
This code example shows how to use the following methods:compare, result
            // 2) Prefer smaller expression trees 
            // 3) Ordering.arbitrary() - creates a stable consistent ordering (extremely useful for unit testing) 
            // TODO: be more precise in determining the cost of an expression 
            return ComparisonChain.start()
                    .compare(DependencyExtractor.extractAll(expression1).size(), DependencyExtractor.extractAll(expression2).size())
                    .compare(SubExpressionExtractor.extract(expression1).size(), SubExpressionExtractor.extract(expression2).size())
                    .compare(expression1, expression2, Ordering.arbitrary())
                    .result();
        } 
    }); 
 
    private final SetMultimap<Expression, Expression> equalitySets; // Indexed by canonical expression
    private final Map<Expression, Expression> canonicalMap; // Map each known expression to canonical expression
    private final Set<Expression> derivedExpressions;
 
    private EqualityInference(Iterable<Set<Expression>> equalityGroups, Set<Expression> derivedExpressions)
    { 
        ImmutableSetMultimap.Builder<Expression, Expression> setBuilder = ImmutableSetMultimap.builder();
        for (Set<Expression> equalityGroup : equalityGroups) {
            if (!equalityGroup.isEmpty()) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compareFalseFirst, result
        @Override 
        public int compareTo(ChangedRow that)
        { 
            return ComparisonChain.start()
                    .compare(this.row, that.row, rowComparator(precision))
                    .compareFalseFirst(this.changed == Changed.ADDED, that.changed == Changed.ADDED)
                    .result();
        } 
    } 
 
    private static class ProgressMonitor 
            implements Consumer<QueryStats>
    { 
        private QueryStats queryStats;
        private boolean finished = false;
 
        @Override 
        public synchronized void accept(QueryStats queryStats)
        { 
            checkState(!finished);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compare
    @Override 
    public int compareTo(CellServicesBean other) {
        return ComparisonChain.start()
               .compare(getName(), other.getName(),
                               Ordering.natural().nullsLast())
               .compare(getDomainName(), other.getDomainName(),
                               Ordering.natural().nullsLast())
               .result();
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compare
    @Override 
    public int compareTo(PoolQueueBean other) {
        return ComparisonChain.start()
               .compare(getName(), other.getName(),
                                   Ordering.natural().nullsLast())
               .compare(getDomainName(), other.getDomainName(),
                                   Ordering.natural().nullsLast())
               .result();
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compare
    @Override 
    public int compareTo(PoolCommandBean other) {
        return ComparisonChain.start()
               .compare(getName(), other.getName(),
                                   Ordering.natural().nullsLast())
               .compare(getDomain(), other.getDomain(),
                                   Ordering.natural().nullsLast())
               .result();
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compare
 
  @Override 
  public int compareTo(PartialDate other) {
    Comparator<Short> comparator = Ordering.natural().nullsFirst();
    return ComparisonChain.start().compare(year, other.getYear(), comparator)
        .compare(month, other.getMonth(), comparator).compare(day, other.getDay(), comparator).result();
  } 
 
} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Guava ComparisonChain Methods: