public static Double largest(Iterator<Double> elements, int k) {
        Iterator<Double> oppositeElements = new Iterator<Double>() {
            /** {@inheritDoc} */
            @Override
            public boolean hasNext() {
                return elements.hasNext();
            }
            
            /** {@inheritDoc} */
            @Override
            public Double next() {
                return -elements.next(); //reverse the sign of every value
            }
        };
        return -smallest(oppositeElements,k); //reverse the sign of the retrieved value
    }
public static Double largest ( Iterator < Double > elements , int k ) { Iterator < Double > oppositeElements = new Iterator < Double > ( ) { @ Override public boolean hasNext ( ) { return elements . hasNext ( ) ; } @ Override public Double next ( ) { return - elements . next ( ) ; } } ; return - smallest ( oppositeElements , k ) ; }
Selects the kth largest element from an iterable object.

@param elements
@param k
@return