1 25 26 package org.snipsnap.notification; 27 28 import java.util.LinkedList ; 29 import java.util.List ; 30 31 37 38 public class NotificationQueue { 39 private List list; 40 41 public NotificationQueue() { 42 list = new LinkedList (); 43 } 44 45 public synchronized void add(String message) { 46 list.add(message); 47 } 48 49 public synchronized String remove() { 50 String message = (String ) list.remove(0); 51 return message; 52 } 53 54 public boolean hasItems() { 55 return !list.isEmpty(); 56 } 57 } 58 | Popular Tags |