Example usage for com.google.common.primitives Longs min

List of usage examples for com.google.common.primitives Longs min

Introduction

In this page you can find the example usage for com.google.common.primitives Longs min.

Prototype

public static long min(long... array) 

Source Link

Document

Returns the least value present in array .

Usage

From source file:com.b2international.snowowl.snomed.datastore.index.update.IconIdUpdater.java

private String getParentFrom(final String conceptId, ISnomedTaxonomyBuilder taxonomyBuilder,
        final Set<String> visitedNodes) {
    if (visitedNodes.add(conceptId)) {
        if (this.availableImages.contains(conceptId)) {
            return conceptId;
        }/*from w  w  w  .j a va  2 s.c o  m*/
        final LongSet ancestorNodeIds = taxonomyBuilder.getAncestorNodeIds(conceptId);
        if (ancestorNodeIds.size() == 0) {
            return null;
        }
        final long minConceptId = Longs.min(ancestorNodeIds.toArray());
        return getParentFrom(Long.toString(minConceptId), taxonomyBuilder, visitedNodes);
    } else {
        // if we reached an already visited node, then skip and return null
        return null;
    }
}

From source file:com.b2international.snowowl.datastore.server.history.HistoryInfoProvider.java

private static Pair<Long, Long> getPreviousAndCurrentTimestamps(final Collection<Long> longs) {
    final long[] timestamps = Longs.toArray(longs);
    final long timestamp = Longs.max(timestamps);
    final long previousTimestamp = Longs.min(timestamps) - 1L;
    return Pair.of(previousTimestamp, timestamp);
}