[SOLVED] Unsafe or unchecked Operation in line 57 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[SOLVED] Unsafe or unchecked Operation in line 57

Can someone explain why I get this compiler warning (at line 57) . And how to prevent this. The output at this point is as expected. https://code.sololearn.com/cbL2ZJT3dBA7/?ref=app

14th Nov 2020, 8:04 PM
Coding Cat
Coding Cat - avatar
2 Answers
+ 3
When you declare private TreeMap<Integer,SortedSet> visited_fields; Don't forget to put in SortedSet's generic type in there as well Fix: private TreeMap<Integer,SortedSet<Integer>> visited_fields; Or you could just put @SuppressWarnings("unchecked") Over the move method just to ignore it, but it's not a fix.
14th Nov 2020, 8:45 PM
Odyel
Odyel - avatar
0
Odyel Thank you. That works. Very nice 👍
14th Nov 2020, 9:04 PM
Coding Cat
Coding Cat - avatar