Java Code Examples for com.google.common.primitives.Longs#compare()
The following examples show how to use
com.google.common.primitives.Longs#compare() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Friend.java From The-5zig-Mod with MIT License | 5 votes |
@Override public int compareTo(Friend friend) { if (friend.isFavorite() && !isFavorite()) return 1; if (isFavorite() && !friend.isFavorite()) return -1; if (The5zigMod.getConfig().getEnum("friendSortation", Sortation.class) == Sortation.ONLINE) { if (getStatus() != friend.getStatus() && (getStatus() != OnlineStatus.OFFLINE || friend.getStatus() != OnlineStatus.OFFLINE)) { return getStatus().compareTo(friend.getStatus()); } else if (getStatus() == OnlineStatus.OFFLINE && friend.getStatus() == OnlineStatus.OFFLINE) { return Longs.compare(friend.lastOnline, lastOnline); } } return getUsername().toLowerCase(Locale.ROOT).compareTo(friend.getUsername().toLowerCase(Locale.ROOT)); }
Example 2
Source File: HDFSTransactionStateStorage.java From phoenix-tephra with Apache License 2.0 | 5 votes |
@Override public int compareTo(TimestampedFilename other) { int res = prefix.compareTo(other.getPrefix()); if (res == 0) { res = Longs.compare(timestamp, other.getTimestamp()); } return res; }
Example 3
Source File: PLong.java From phoenix with Apache License 2.0 | 5 votes |
@Override public int compareTo(Object lhs, Object rhs, PDataType rhsType) { if (rhsType == PDecimal.INSTANCE) { return -((BigDecimal) rhs).compareTo(BigDecimal.valueOf(((Number) lhs).longValue())); } else if (equalsAny(rhsType, PDouble.INSTANCE, PFloat.INSTANCE, PUnsignedDouble.INSTANCE, PUnsignedFloat.INSTANCE)) { return Doubles.compare(((Number) lhs).doubleValue(), ((Number) rhs).doubleValue()); } return Longs.compare(((Number) lhs).longValue(), ((Number) rhs).longValue()); }
Example 4
Source File: VariableUsageStatistics.java From naturalize with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public int compareTo(UsageStats other) { return Longs.compare(timesSeen, other.timesSeen); }
Example 5
Source File: JvmJsonService.java From glowroot with Apache License 2.0 | 4 votes |
@Override public int compare(ThreadDump.Thread left, ThreadDump.Thread right) { return Longs.compare(right.getId(), left.getId()); }
Example 6
Source File: MultiErrorIntervalMerger.java From glowroot with Apache License 2.0 | 4 votes |
@Override public int compare(GroupedMultiErrorInterval left, GroupedMultiErrorInterval right) { return Longs.compare(left.from(), right.from()); }
Example 7
Source File: AbstractElement.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
public static int compare(TitanElement e1, TitanElement e2) { long e1id = (e1 instanceof AbstractElement)?((AbstractElement)e1).getCompareId():e1.longId(); long e2id = (e2 instanceof AbstractElement)?((AbstractElement)e2).getCompareId():e2.longId(); return Longs.compare(e1id,e2id); }
Example 8
Source File: SimpleFlamdexWriter.java From imhotep with Apache License 2.0 | 4 votes |
@Override public int compareTo(IntTermIteratorWrapper o) { final int cmp; return (cmp = Longs.compare(it.term(), o.it.term())) != 0 ? cmp : Ints.compare(index, o.index); }
Example 9
Source File: AbstractElement.java From grakn with GNU Affero General Public License v3.0 | 4 votes |
public static int compare(JanusGraphElement e1, JanusGraphElement e2) { long e1id = (e1 instanceof AbstractElement) ? ((AbstractElement) e1).getCompareId() : e1.longId(); long e2id = (e2 instanceof AbstractElement) ? ((AbstractElement) e2).getCompareId() : e2.longId(); return Longs.compare(e1id, e2id); }
Example 10
Source File: Token.java From sasi with Apache License 2.0 | 4 votes |
@Override public int compareTo(CombinedValue<Long> o) { return Longs.compare(token, ((Token) o).token); }
Example 11
Source File: MultiWorkUnitWeightedQueue.java From incubator-gobblin with Apache License 2.0 | 4 votes |
/** * Compare with the other weightedMultiWorkUnit based on weight. */ @Override public int compareTo(WeightedMultiWorkUnit weightedMultiWorkUnit) { return Longs.compare(this.weight, weightedMultiWorkUnit.getWeight()); }
Example 12
Source File: DefaultDelayingQueue.java From java with Apache License 2.0 | 4 votes |
@Override public int compareTo(Delayed o) { return Longs.compare(getDelay(TimeUnit.MILLISECONDS), o.getDelay(TimeUnit.MILLISECONDS)); }
Example 13
Source File: S3LogResource.java From Singularity with Apache License 2.0 | 4 votes |
@Override public int compare(SingularityS3LogMetadata o1, SingularityS3LogMetadata o2) { return Longs.compare(o2.getLastModified(), o1.getLastModified()); }
Example 14
Source File: HeapHistogramTool.java From glowroot with Apache License 2.0 | 4 votes |
@Override public int compare(ClassInfo left, ClassInfo right) { return Longs.compare(right.bytes, left.bytes); }
Example 15
Source File: Coin.java From GreenBits with GNU General Public License v3.0 | 4 votes |
@Override public int compareTo(final Coin other) { return Longs.compare(this.value, other.value); }
Example 16
Source File: PMetaDataImpl.java From phoenix with Apache License 2.0 | 4 votes |
@Override public int compare(PTableRef tableRef1, PTableRef tableRef2) { return Longs.compare(tableRef1.lastAccessTime, tableRef2.lastAccessTime); }
Example 17
Source File: SingularityTaskShellCommandRequest.java From Singularity with Apache License 2.0 | 4 votes |
@Override public int compareTo(SingularityTaskShellCommandRequest o) { return Longs.compare(o.getTimestamp(), timestamp); }
Example 18
Source File: EntryCacheImpl.java From pulsar with Apache License 2.0 | 4 votes |
@Override public int compareTo(EntryCache other) { return Longs.compare(getSize(), other.getSize()); }
Example 19
Source File: JobIdImpl.java From scheduling with GNU Affero General Public License v3.0 | 4 votes |
/** * {@inheritDoc} */ @Override public int compareTo(JobId jobId) { return Longs.compare(id, ((JobIdImpl) jobId).id); }
Example 20
Source File: TimeUUIDs.java From emodb with Apache License 2.0 | 2 votes |
/** * Compare the embedded timestamps of the given UUIDs. This is used when it is OK to return * an equality based on timestamps alone * @throws UnsupportedOperationException if either uuid is not a timestamp UUID */ public static int compareTimestamps(UUID uuid1, UUID uuid2) { return Longs.compare(uuid1.timestamp(), uuid2.timestamp()); }