Java Iterator from getLast(Iterator iterator)

Here you can find the source of getLast(Iterator iterator)

Description

get Last

License

Open Source License

Declaration

public static <T> T getLast(Iterator<T> iterator) 

Method Source Code


//package com.java2s;
/*/*from  www  .ja v a2  s.  c om*/
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
 */

import java.util.Iterator;

public class Main {
    public static <T> T getLast(Iterator<T> iterator) {
        T last = null;
        while (iterator.hasNext()) {
            last = iterator.next();
        }

        return last;
    }
}

Related

  1. getIterator(final Object o, final Class classElement)
  2. getIterator(List list)
  3. getIterator(T[] array)
  4. getIteratorAsString(Iterator iter, final String separator)
  5. getIteratorOptionalValue(final Iterator stringIterator)
  6. getList(Iterator iterator)
  7. getMaxLength(Iterator i)
  8. getPerplexity(Iterator probStream)
  9. getPersistentKeysIterator(HashMap hashMap)