of-commons-collections/src/main/java/org/openforis/commons/collection/CollectionUtils.java
/**
	 * Shifts the item to the specified index.
	 */
Shifts the item to the specified index.
Shifts the item to the specified index .
public static <T> void shiftItem(List<T> list, T item, int toIndex) {
		int oldIndex = list.indexOf(item);
		if ( oldIndex < 0 ) {
			throw new IllegalArgumentException("Item not found");
		}
		if ( toIndex >= 0 && toIndex < list.size() ) {
			list.remove(oldIndex);
			list.add(toIndex, item);
		} else {
			throw new IndexOutOfBoundsException("Index out of bounds: " + toIndex + " (list size = " + list.size() + ")");
		}
	}
public static < T > void shiftItem ( List < T > list , T item , int toIndex ) { int oldIndex = list . indexOf ( item ) ; if ( oldIndex < 0 ) { throw new IllegalArgumentException ( "Item not found" ) ; } if ( toIndex >= 0 && toIndex < list . size ( ) ) { list . remove ( oldIndex ) ; list . add ( toIndex , item ) ; } else { throw new IndexOutOfBoundsException ( "Index out of bounds: " + toIndex + " (list size = " + list . size ( ) + ")" ) ; } }
Shifts the item to the specified index.
Shifts the item to the specified index .