I am creating a deque using generic type E...
Having trouble initializing some sort of generic array, while being type safe, have tried casting, however this is Type safety: Unchecked cast from Object[] to E[]
public class DequeCyclic<E> implements Deque<E> {
private E[] line;
public DequeCyclic(int size) {
E[] line = (E[])new Object[size];
}
}
Could I put in @SuppressWarnings("unchecked")
to ignore the type safety issue?
What is another way to create the generic deque/array?