class ListUtils {

    public static <Item> SparseIntArray getReorderings(List<? extends Item> oldList, List<? extends Item> newList){
        List<Pair<Integer, Integer>> moveList = calculateMoves(oldList, newList);
        List<Integer> netMoveScores = calculateNetMoveScores(moveList);
        SparseIntArray reorderings = new SparseIntArray();
        while(extractReordering(moveList, netMoveScores, reorderings));
        return reorderings;
    }

}

class ListUtilsTest {

    private static final List<Integer> list05;
    private static final List<Integer> list15;
    private static final List<Integer> list06;
    private static final List<Integer> listFlip;
    private static final List<Integer> listGap;
    private static final List<Integer> listMultiReorder;
    private static final List<Integer> listSwap;

    @Test
    public void testReorderSwap() {

        SparseIntArray reorderings = ListUtils.getReorderings(list05, listSwap);
        assertThat(reorderings.size(), is(2));
        assertThat(reorderings.get(5), is(0));
        assertThat(reorderings.get(0), is(5));
    }

}