### Question:
Lists { public static <E> ArrayList<E> distinctElements(List<E> list) { ArrayList<E> newList = new ArrayList<E>(); HashSet<E> hashSet = new HashSet<E>(); for (E e : list) { if (!hashSet.contains(e)) { newList.add(e); hashSet.add(e); } } return newList; }  static boolean arrayListsEqual(ArrayList<?> list1, ArrayList<?> list2); static int arrayListHashCode(ArrayList<?> list); static ArrayList<E> distinctElements(List<E> list);  }### Answer:
@Test public void testListDistinctElement(){ ArrayList<Integer> a = new ArrayList<Integer>(); a.add(3); a.add(2); a.add(2); a.add(4); List<Integer> output = Lists.distinctElements(a); assertEquals(3, output.size()); assertEquals(3, (int) output.get(0)); assertEquals(2, (int) output.get(1)); assertEquals(4, (int) output.get(2)); }