This is the code I have right now
public class removerDuplicados<T> {
public removerDuplicados() {
}
public T[] removerDups(T [] arr) {
T[] res = Arrays.stream(arr).distinct().toArray();
return res;
}
}
But this line
T[] res = Arrays.stream(arr).distinct().toArray();
Gives me incompatible types error
T[] res = (T[]) (Arrays.stream(arr).distinct().toArray()) ;