+/EE360P
distributed systems
git clone https://git.julia.blue/+/EE360P
df69975
master
1public class ListQueue { 2class Node { 3public String data ; 4public Node next ; 5 } 6Node head =null ,tail =null ; 7public synchronized void enqueue (String data ) { 8Node temp =new Node (); 9temp .data =data ; 10temp .next =null ; 11if (tail ==null ) { 12tail =temp ; 13head =tail ; 14 }else { 15tail .next =temp ; 16tail =temp ; 17 } 18notify (); 19 } 20public synchronized String dequeue () { 21while (head ==null ) 22Util .myWait (this ); 23String returnval =head .data ; 24if (head ==tail )tail =null ; 25head =head .next ; 26return returnval ; 27 } 28}