import java.util.*;
class pqr
{
public static void main(String ab[])
{
List<Integer> ts=new ArrayList<Integer>();
for(int i=0;i<10;i++)
ts.add((int)(Math.random()*1000));
System.out.println(ts);
class RSO implements Comparator<Integer>
{
public int compare(Integer i,Integer j)
{
return j-i;
}
}
RSO rs=new RSO();
Collections.sort(ts,rs);
System.out.println(ts);
Comparator fs=(Comparator<Integer>)Collections.reverseOrder(rs); // Same result with casting or without casting
Collections.sort(ts,fs);
System.out.println(ts);
}
}
Этот код дает мне ожидаемый результат, но при компиляции он показывает следующее предупреждающее сообщение для 5-й линии от конца:статический Компаратор Collections.reverseOrder (Comarator) показывая предупреждение
Note: 5.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
I я получаю такое же предупреждение с или без кастинга, пожалуйста, помогите мне удалить предупреждение.
ohh noo !! спасибо, кстати ... – user1926364