inner classes - Java: "uses unchecked or unsafe operations. Recompile with..." -


While spending significant time answering my life and rereading the generics chapter in my Java textbook, I can not fix problems with:

  public class RedBlackTree & lt; I compare & gt; {Private int calculation = 0; Private Red Black Node root; Private Red Black Node On Personal Red Black Node [] Stack; / ** * Internal range used to represent the nodes of red-black balanced binary search tree object. * / Private Class RedBlackNode implements comparative {Private I ID; Private boolean is_btree; Private red black node [] link; / ** * Constructor for objects of the RedBlackNode class. * * @ ID of the ultimate ID node * / personal red black node (id) {if (id == blank) {new nullioner exception ("ID can not be empty"); } This.id = id; This.is_btree = true; } / ** * Function to compare with the other object of the RedBlackNode object. * @ @ To compare the ultimate obj object * @ Return if inocent & gt; Passed, 1 returns; If the attacker & lt; Pass, return -1; If invocant = passed, 0 returns / to compute private object (object obj) {if (obb instanceof RedBlackTree.RedBlackNode) {RedBlackNode node = (RedBlackNode) obj; Int results = id.compareTo (node.id); Return Results & gt; 0? 1: results & lt; 0? -1: 0; } And {New class class throw exception ("A red blackened object is expected."); }}}}   

Specifically, I am getting a popup with the following message:

  Warning C: \ Users \ from the last compilation. . \ RedBlackTree.java uses unchecked or unsafe operations. Recompile with Exclant: Uncheck for details   

Almost every combination or comparison here goes to such popups. I am using the blues environment for programming and it makes it impossible to include relevant compiler logic to see any details.

As far as I can see from my research, this is something to do with the fact that in the internal category I use the normal type and therefore implement the "red black node comparative" And the comparative method is to fight this fact in any way in the Red Blackened Inner class.

I know that this question is asked here in Stack Overflow and elsewhere and has answered many times, but I can not apply the cases I have learned in my case. I am very new to Generic, so I can get any help here, I would be greatly appreciated!

Make the following changes

  public class RedBlackTree & lt; I compare Comparative & lt; I & gt; & Gt; The Private Class RedBlackNode implies Comparable & lt; RedBlackNode & gt; Compare override public int (red black node node) Favored Results = id.compareTo (node.id); Return Results & gt; 0? 1: results & lt; 0? -1: 0;   

Keep public in mind to remove type test, so always use @override .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -