Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

unchecked or unsafe operations.

843810May 16 2005 — edited Mar 6 2007
When I compile my java file I get the following msg:

Note: test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

I tried to compile it with the -Xlint and I got this msg:

test.java:1829: warning: [unchecked] unchecked conversion
found : <anonymous java.util.Comparator>
required: java.util.Comparator<? super int[]>
Arrays.sort(myarray, new Comparator(){
^
test.java:1829: warning: [unchecked] unchecked method invocation: <T>sort(T[],j
ava.util.Comparator<? super T>) in java.util.Arrays is applied to (int[][],<anon
ymous java.util.Comparator>)
Arrays.sort(myarray, new Comparator(){
^
2 warnings

It seems like the problem lays in the following code-block:

public static void sort(int[][] myarray){

Arrays.sort(myarray, new Comparator(){
public int compare(Object o1, Object o2) {
int[] i1 = (int[]) o1;
int[] i2 = (int[]) o2;
return Double.compare(i1[0], i2[0]);
}
});
}


Can someone please tell me what to do and what this error means?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 3 2007
Added on May 16 2005
4 comments
350 views