Advertisement
Yuvalxp8

Check if a Char is in a Node

Feb 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1.     public static boolean isCharInNode(Character c, Node<Character> N)
  2.     {
  3.         Node<Character> duplicate = N;
  4.         if(duplicate == null)
  5.             return false;
  6.        
  7.         while(duplicate.hasNext())
  8.         {
  9.             if(c == duplicate.getValue())
  10.                 return true;
  11.             else
  12.                 duplicate = duplicate.getNext();
  13.         }
  14.        
  15.         if(c == duplicate.getValue())
  16.             return true;
  17.        
  18.         return false;  
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement