// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import java.util.*;

// singleton klasse
public class S3 {
   // normale attributter eksemplificeret ved en List
   private List list;
   // den eneste instans der eksisterer
   private static S3 instance = null;
   // private constructor
   private S3() {
      list = new ArrayList();
   }
   // public static metode til at hente instance
   public static synchronized S3 getInstance() {
      if(instance == null) {
         instance = new S3();
      }
      return instance;
   }
   // normale metoder
   public synchronized void add(Object o) {
      list.add(o);
   }
   public List getList() {
      return list;
   }
}
