Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Node
- {
- private String token_;
- private Node next_;
- public Node(String token, Node next){
- token_ = token;
- next_ = next;
- }
- public void Add(String s){
- Node a = new Node(s);
- a.next = head;
- head = a;
- }
- public int find(String word){
- int counter = 0;
- Node current = token_;
- while(current != null){
- if(current.token_ == word){
- return counter;
- }
- else{
- current = current.next;
- counter++;
- }
- }
- return -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement