如何在这种方法中摆脱 @SuppressWarnings("unchecked") ?
@SuppressWarnings("unchecked")
public <T> Worker<T> findSimilarWorker(Worker<T> worker) {
// The variable workers is a Set<Worker<?>>
for(Worker<?> w : workers) {
// The following line is unchecked cast
if(w.isSimilar(worker)) return (Worker<T>) w;
}
return null;
}