Java AtomicLong Accumulator min(List list)

Here you can find the source of min(List list)

Description

min

License

Open Source License

Declaration

public static Long min(List<Long> list) 

Method Source Code


//package com.java2s;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.LongAccumulator;

public class Main {
    public static Long min(List<Long> list) {
        Objects.requireNonNull(list, "list is null");
        if (list.isEmpty()) {
            throw new IllegalArgumentException("list is empty");
        }//from   w  w  w  .j  a  va 2s  . c o m

        LongAccumulator la = new LongAccumulator((left, right) -> {
            return left > right ? right : left;
        }, Long.MAX_VALUE);

        list.parallelStream().forEach(e -> la.accumulate(e));
        return la.longValue();
    }
}

Related

  1. addInlineCollectionToSqlString(StringBuilder sql, Collection values)
  2. calculateMemory()
  3. getDefaultSSLProtocol()
  4. getEnabledSSLProtocols()
  5. getIncrement()
  6. random()
  7. setEnabledSSLProtocols(final Collection enabledSSLProtocols)
  8. signalAll(AtomicBoolean condition)
  9. waitForCondition(final AtomicBoolean condition, long timeout)