SHARE
TWEET

Untitled

a guest Apr 19th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. public class Rijeci {
  3.     Node glava;
  4.  
  5.     public Rijeci(Node glava) {
  6.         this.glava = glava;
  7.     }
  8.  
  9.     public void printList() {
  10.         Node current = glava;
  11.         System.out.print(glava.data+" ");
  12.         current = glava.next;
  13.     }
  14.  
  15.     public void insert(String d) {
  16.        
  17.     }
  18.  
  19.     public void delete(String d, int k) {
  20.         Node current = glava.next;
  21.         Node prev = glava;
  22.         while(current != null) {
  23.             if(current.data.length > k && !current.data.equals(d)) {
  24.                 prev.next = current.next;
  25.                 current.next = null;
  26.                 current = prev.next;
  27.                 prev = current;
  28.  
  29.             } else {
  30.                 current = current.next;
  31.                 prev = current;
  32.             }
  33.            
  34.         }
  35.     }
  36.  
  37.     private class Node {
  38.         String data;
  39.         Node next;
  40.  
  41.         public Node(String data, Node next) {
  42.             this.data = data;
  43.             this.next = next;
  44.         }
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top