1public static <T extends Comparable<T>> void getDuplicates(T[] array) {
2 Set<T> dupes = new HashSet<T>();
3 for (T i : array) {
4 if (!dupes.add(i)) {
5 System.out.println("Duplicate element in array is : " + i);
6 }
7 }
8
9 }