本文整理匯總了Java中com.google.common.primitives.Ints.compare方法的典型用法代碼示例。如果您正苦於以下問題:Java Ints.compare方法的具體用法?Java Ints.compare怎麽用?Java Ints.compare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.primitives.Ints
的用法示例。
在下文中一共展示了Ints.compare方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compareAsList
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
public static <T extends Comparable<? super T>> int compareAsList(@Nonnull Collection<? extends T> list1,
@Nonnull Collection<? extends T> list2) {
int res = Ints.compare(list1.size(), list2.size());
if (res != 0) return res;
Iterator<? extends T> elements2 = list2.iterator();
for (T element1: list1) {
res = element1.compareTo(elements2.next());
if (res != 0) return res;
}
return 0;
}
示例2: compareAsSet
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
public static <T extends Comparable<T>> int compareAsSet(@Nonnull Collection<? extends T> set1,
@Nonnull Collection<? extends T> set2) {
int res = Ints.compare(set1.size(), set2.size());
if (res != 0) return res;
SortedSet<? extends T> sortedSet1 = toNaturalSortedSet(set1);
SortedSet<? extends T> sortedSet2 = toNaturalSortedSet(set2);
Iterator<? extends T> elements2 = set2.iterator();
for (T element1: set1) {
res = element1.compareTo(elements2.next());
if (res != 0) return res;
}
return 0;
}
示例3: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
AnnotationEncodedValue other = (AnnotationEncodedValue)o;
res = getType().compareTo(other.getType());
if (res != 0) return res;
return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
示例4: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(AllocRecord e) {
if (alloc.getBytes() != e.alloc.getBytes()) {
throw new RuntimeException("Can only compare within a particular array");
}
return Ints.compare(alloc.getOffset(), e.alloc.getOffset());
}
示例5: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return Chars.compare(getValue(), ((CharEncodedValue)o).getValue());
}
示例6: compare
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override public int compare(Invokable<?, ?> left, Invokable<?, ?> right) {
return Ints.compare(left.getParameters().size(), right.getParameters().size());
}
示例7: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(Element that) {
return Ints.compare(hash, that.hash);
}
示例8: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(Composite<T> that) {
return Ints.compare(rank, that.rank);
}
示例9: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return Longs.compare(getValue(), ((LongEncodedValue)o).getValue());
}
示例10: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* This implementation uses an optimized Google Guava method to compare <code>bytes</code>.
*/
@Override
public int compareTo(VersionedChecksummedBytes o) {
int result = Ints.compare(this.version, o.version);
return result != 0 ? result : UnsignedBytes.lexicographicalComparator().compare(this.bytes, o.bytes);
}
示例11: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
示例12: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((FieldEncodedValue)o).getValue());
}
示例13: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(Pair o) {
return -Ints.compare(count, o.count);
}
示例14: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(ChildNumber other) {
// note that in this implementation compareTo() is not consistent with equals()
return Ints.compare(this.num(), other.num());
}
示例15: compareTo
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((TypeEncodedValue)o).getValue());
}