@Test public void calculate_completeSwap() { DiffHelper.Result result = DiffHelper.calculate(Collections.singleton(A), Collections.singleton(B)); assertContentsEqual(Collections.singleton(B), result.getInserted()); assertContentsEqual(Collections.singleton(A), result.getRemoved()); }
public static <E> Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList) { Set<E> inserted = SetUtil.difference(newList, oldList); Set<E> removed = SetUtil.difference(oldList, newList); return new Result<>(inserted, removed); }
DiffHelper { public static <E> Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList) { Set<E> inserted = SetUtil.difference(newList, oldList); Set<E> removed = SetUtil.difference(oldList, newList); return new Result<>(inserted, removed); } }
DiffHelper { public static <E> Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList) { Set<E> inserted = SetUtil.difference(newList, oldList); Set<E> removed = SetUtil.difference(oldList, newList); return new Result<>(inserted, removed); }  }
DiffHelper { public static <E> Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList) { Set<E> inserted = SetUtil.difference(newList, oldList); Set<E> removed = SetUtil.difference(oldList, newList); return new Result<>(inserted, removed); }  static Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList); }
DiffHelper { public static <E> Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList) { Set<E> inserted = SetUtil.difference(newList, oldList); Set<E> removed = SetUtil.difference(oldList, newList); return new Result<>(inserted, removed); }  static Result<E> calculate(@NonNull Collection<E> oldList, @NonNull Collection<E> newList);  }