Java Stream Operation factorStream(long number)

Here you can find the source of factorStream(long number)

Description

factor Stream

License

Apache License

Declaration

public static LongStream factorStream(long number) 

Method Source Code

    //package com.java2s;
    //License from project: Apache License 

    import java.util.stream.LongStream;

    public class Main {
        public static LongStream factorStream(long number) {
  return LongStream.rangeClosed(2, (long) Math.sqrt(number))
      .filter(f -> number % f == 0)/* ww  w . j a v a2  s. c  o m*/
      .flatMap(f -> LongStream.of(f, number / f))
      .sorted();
}
    }

Related

  1. containsOnly(Stream stream, long size)
  2. createStream(final Iterator iterator)
  3. endsWith(Stream stream, Iterable iterable)
  4. enumerationAsStream(Enumeration e)
  5. equals(Stream first, Stream second)
  6. filterInstances(Stream stream, Class clazz)
  7. filterType(Stream stream, Class type)
  8. findLast(Stream s)
  9. findLastOf(Stream stream)