private static long [ ] computeParameters ( final LongIterator iterator ) { long v = - 1 , prev = - 1 , c = 0 ; while ( iterator . hasNext ( ) ) { v = iterator . nextLong ( ) ; if ( prev > v ) throw new IllegalArgumentException ( "The list of values is not monotone: " + prev + " > " + v ) ; prev = v ; c ++ ; } return new long [ ] { c , v } ; }
Computes the number of elements and the last element returned by the given iterator .