Java List Move Item moveUpInListSingleEntry(List list, int index)

Here you can find the source of moveUpInListSingleEntry(List list, int index)

Description

move Up In List Single Entry

License

Open Source License

Declaration

private static <E> boolean moveUpInListSingleEntry(List<E> list, int index) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    private static <E> boolean moveUpInListSingleEntry(List<E> list, int index) {
        // ignore calls which try to move up first index
        if (index == 0) {
            return false;
        }/*from ww w  . jav  a2s.  c om*/
        E element = list.remove(index);
        list.add(index - 1, element);
        return true;
    }
}

Related

  1. moveTop(List list, int[] indices)
  2. moveUp(final List list, final T toMoveUp)
  3. moveUp(List list, List toMoveUp)
  4. moveUp(List list, int[] selectionIndexes)
  5. moveUpInList(List list, int... indices)

  6. HOME | Copyright © www.java2s.com 2016