public class obj {
  private List<String> data;

  public synchronized String get() {
     while (this.data.size() == 0) {
        wait();
        // Ommitted Java exception handling bs
        /*
        try {
          wait();
        } catch (InterruptedException no) {
           System.err.println("JAVA SUCKS");
           probably do something else here idk
        }
        */
     }
     return this.data.remove(0);
  }

  public synchronized void set(String new_data) {
     this.data.add(new_data);
     notifyAll();
  }

}
