Java ListIterator Usage getCurrentElement(ListIterator listIterator)

Here you can find the source of getCurrentElement(ListIterator listIterator)

Description

get Current Element

License

Open Source License

Return

the element the given listIterator currently refers to. (uses #previous and #next)

Declaration

public static <E> E getCurrentElement(ListIterator<E> listIterator) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007 Bruno Medeiros and other Contributors.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/* www.  j a va 2 s  .  c om*/
 *     Bruno Medeiros - initial implementation
 *******************************************************************************/

import java.util.ListIterator;

public class Main {
    /** @return the element the given listIterator currently refers to. (uses #previous and #next) */
    public static <E> E getCurrentElement(ListIterator<E> listIterator) {
        listIterator.previous();
        return listIterator.next();
    }
}

Related

  1. findFirstIterator(List list, int fromIndex, int toIndex, T value, Comparator comparator)
  2. findObject(Object item, ListIterator iter)
  3. findPrevious(ListIterator iter)
  4. getAll_SequentialAccess( List idxs, List values)
  5. getCamelNameSegments(String camelName)
  6. getLastNonNull(List l)
  7. goToFirst(ListIterator iterator)
  8. gotoIndex(ListIterator iterator, int index)
  9. incrementalComponentWiseAverageArbitraryDepth(Object average, int n, Object newItems)