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; }  static SparseBooleanArray getInsertions(@Nullable List<? extends Item> oldList, @NonNull List<? extends Item> newList); static SparseBooleanArray getDeletions(@Nullable List<? extends Item> oldList, @NonNull List<? extends Item> newList); static SparseIntArray getReorderings(List<? extends Item> oldList, List<? extends Item> newList);  }
@Test public void testSingleReorderGapUp() { SparseIntArray reorderings = ListUtils.getReorderings(listGap, list05); assertThat(reorderings.size(), is(1)); assertThat(reorderings.get(5), is(0)); }
@Test public void testMultiReorderUp() { SparseIntArray reorderings = ListUtils.getReorderings(listMultiReorder, list05); assertThat(reorderings.size(), is(2)); assertThat(reorderings.get(5), is(0)); assertThat(reorderings.get(4), is(2)); }
@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)); }
@Test public void testSingleReorderDown() { SparseIntArray reorderings = ListUtils.getReorderings(list05, listFlip); assertThat(reorderings.size(), is(1)); assertThat(reorderings.get(4), is(5)); }
@Test public void testSingleReorderGapDown() { SparseIntArray reorderings = ListUtils.getReorderings(list05, listGap); assertThat(reorderings.size(), is(1)); assertThat(reorderings.get(0), is(5)); }
@Test public void testMultiReorderDown() { SparseIntArray reorderings = ListUtils.getReorderings(list05, listMultiReorder); assertThat(reorderings.size(), is(2)); assertThat(reorderings.get(0), is(5)); assertThat(reorderings.get(2), is(4)); }
@Test public void testSingleReorderUp() { SparseIntArray reorderings = ListUtils.getReorderings(listFlip, list05); assertThat(reorderings.size(), is(1)); assertThat(reorderings.get(4), is(5)); }