Collections.sort(list, new Comparator<Long>() { public int compare(Long o1, Long o2) { return o2.compareTo(o1); } });
@Override public int compare(MediaStoreData mediaStoreData, MediaStoreData mediaStoreData2) { return Long.valueOf(mediaStoreData2.dateTaken).compareTo(mediaStoreData.dateTaken); } });
@Override public int compare(AnalyzedHeap lhs, AnalyzedHeap rhs) { return Long.valueOf(rhs.selfFile.lastModified()) .compareTo(lhs.selfFile.lastModified()); } });
@Override public int compareTo(Vertex vertex) { return Long.valueOf(id).compareTo(vertex.id); }
@Override public int compare(File lhs, File rhs) { return Long.valueOf(lhs.lastModified()).compareTo(rhs.lastModified()); } });
@Override public int compare(KinesisMessageId o1, KinesisMessageId o2) { return retryTimes.get(o1).compareTo(retryTimes.get(o2)); } }
@Override public int compare(FileStatus o1, FileStatus o2) { return new Long(o1.getModificationTime()).compareTo(o2.getModificationTime()); } }
@Override public int compare(String o1, String o2) { try { Long v1 = Long.valueOf(o1); Long v2 = Long.valueOf(o2); return v1.compareTo(v2); } catch (Exception e) { return o1.compareTo(o2); } }
@Override public int compare(Tuple2<Long, Long> o1, Tuple2<Long, Long> o2) { return o1.f0.compareTo(o2.f0); } });
private Long getStoredCurrTransaction() { Long ret = INIT_TXID; for (TransactionalState state : _states) { Long curr = (Long) state.getData(CURRENT_TX); if (curr != null && curr.compareTo(ret) > 0) { ret = curr; } } return ret; }
@Override public int compare(Object aObj, Object bObj) { if (aObj instanceof Long && bObj instanceof Long) { Long a = (Long) aObj; Long b = (Long) bObj; return a.compareTo(b); } return super.compare(aObj, bObj); }
@Override public int compare(RetrySchedule entry1, RetrySchedule entry2) { int result = Long.valueOf(entry1.nextRetryTimeNanos()).compareTo(entry2.nextRetryTimeNanos()); if (result == 0) { //TreeSet uses compareTo instead of equals() for the Set contract //Ensure that we can save two retry schedules with the same timestamp result = entry1.hashCode() - entry2.hashCode(); } return result; } }
@Override public int compareTo(Delayed o) { return new Long(getDelay(TimeUnit.MILLISECONDS)).compareTo(o.getDelay(TimeUnit.MILLISECONDS)); } }
@Override public int compareTo( @NotNull OrderedSequenceNumber<Long> o ) { return this.get().compareTo(o.get()); }
public void testCompare() { for (long x : VALUES) { for (long y : VALUES) { // note: spec requires only that the sign is the same assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y)); } } }
@Override public int compareTo(EventDataWrap ed) { return messageId.getSequenceNumber(). compareTo(ed.getMessageId().getSequenceNumber()); } }
public int compare(Description o1, Description o2) { // Always prefer new tests if (isNewTest(o1)) { return -1; } if (isNewTest(o2)) { return 1; } // Then most recently failed first int result = getFailure(o2).compareTo(getFailure(o1)); return result != 0 ? result // Then shorter tests first : getTestDuration(o1).compareTo(getTestDuration(o2)); }
private List<PropertyContainer> sortedEntities( LinkedList<Pair<PropertyContainer, Long>> timestamps, final boolean reversed ) { List<Pair<PropertyContainer, Long>> sorted = new ArrayList<>( timestamps ); sorted.sort( ( o1, o2 ) -> !reversed ? o1.other().compareTo( o2.other() ) : o2.other().compareTo( o1.other() ) ); List<PropertyContainer> result = new ArrayList<>(); for ( Pair<PropertyContainer, Long> timestamp : sorted ) { result.add( timestamp.first() ); } return result; }