Possible Duplicate:
How do I address unchecked cast warnings?
My program compiles and works correctly when I compile with -Xlint:unchecked, but I am looking for assistance to remove this warning. Any help is appreciated! Thank you
This is the warning:
java: warning: [unchecked] unchecked cast found : E required: java.lang.Comparable<E> ^^^^ The code the gives the warning is:
public boolean contains(E obj) { Node<E> curr = head; while (curr != null) { return true; } curr = curr.next; } return false; }
ClassCastExceptionif theEclass doesn't implement theComparable<E>interface when calling thecontainsmethod.