Forums Register Login

Java 5, Collections warning in Eclipse

+Pie Number of slices to send: Send
Hi, I'm using Java 5.0, with Eclipse.
I have this code below, which gives a warning as stated below:



The word comp gets underlined in yellow in eclipse, as shown above in italics, and it says:


Type safety: The expression of type Comp needs unchecked conversion to conform to Comparator<? super SetObj>



Can anyone explain what this means and how I can fix it without just supressing the warning.

Thanks
[ April 19, 2007: Message edited by: colin shuker ]
+Pie Number of slices to send: Send
The reason is that you are trying to create a TreeSet with a type by using a Comparator that has a raw type.

To get rid of the warning, instead of implementing the raw interface Comparator, you can implement the interface Comparator<SetObj>.
It will give me the powers of the gods. Not bad for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 947 times.
Similar Threads
Sorting Collection
making a mostly anonymous Comparator be Serializable
TreeSet adding twice null
default JFileChooser to details view Mode
how sort a array of files and directories.. ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:20:14.