Here you can find the source of moveUp(final List
public static <T> boolean moveUp(final List<T> list, final T toMoveUp)
//package com.java2s; /*/*from w ww . jav a 2 s . c o m*/ * Copyright 2016 Nokia Solutions and Networks * Licensed under the Apache License, Version 2.0, * see license.txt file for details. */ import java.util.Collections; import java.util.List; public class Main { public static <T> boolean moveUp(final List<T> list, final T toMoveUp) { boolean result = false; if (list.size() >= 2) { int elemIndex = list.indexOf(toMoveUp); if (elemIndex > 0) { Collections.swap(list, elemIndex, elemIndex - 1); result = true; } } return result; } }