title: The output I'm trying to print doesn't print, trying to make a text based alarm clock with a HashMap
body: <p>I'm trying to compare the current time to the values in a HashMap to print a notification message (like an alarm). However, it doesn't print when the current time hits the time equal to a value within the HashMap. Is this because there isn't enough time for the containsValue method to iterate of the HashMap or another reason? Here is my relevant code:</p>
  
  <pre><code>private SimpleDateFormat timeFormat = new SimpleDateFormat("kk:mm:ss");
  
  @Override
      public void run() {
          while (true) {
              String currentTime = getCurrentTime();
                  if (callLog.containsValue(currentTime)) {
                      System.out.println("it works!");
                  }
      }
  
  public String getCurrentTime() {
          Date time = Calendar.getInstance().getTime();
          String currentTIme = timeFormat.format(time);
          return currentTIme;
      }
  </code></pre>
  
  <p><strong>Edit:</strong> Okay, I've figured out my problem with a few tweaks. My if check works if I run the program at the exact moment I set the alarm for. If I wait for the alarm to go off (say 2 minutes after the program runs) the message doesn't get sent. Modified code below:</p>
  
  <pre><code>private HashMap&lt;Integer, String&gt; callLog;
          private SimpleDateFormat timeFormat = new SimpleDateFormat("kk:mm:ss");
          private String wakeUpMessage = "This is your automatic wake up call for room number: ";
          private String nextCall;
          private Thread thread;
  
          public HotelSystem() {
              callLog = new LinkedHashMap&lt;Integer, String&gt;();
              this.thread = new Thread(this);
              this.thread.start();
              setAlarmTime(4, "20:45:00");
          }
  
          @Override
          public void run() {
              while (true) {
                  if (callLog.containsValue(getCurrentTime())) {
                      System.out.println(getCurrentTime());
                      sendAlarmCall(4);
                  }
              }
          }
  
          // sends a generic alarm call message followed by the room number
          public void sendAlarmCall(int roomNumber) {
              System.out.println(wakeUpMessage + roomNumber);
          }
  
  public String getCurrentTime() {
          Date time = Calendar.getInstance().getTime();
          String currentTIme = timeFormat.format(time);
          return currentTIme;
      }
  
      public void setAlarmTime(int roomNumber, String time) {
          Date alarmDate;
          try {
              alarmDate = timeFormat.parse(time);
              String alarmTime = timeFormat.format(alarmDate);
              callLog.put(roomNumber, alarmTime);
              System.out.println("You entered room number: " + roomNumber + " and wake up time of: " + alarmTime);
          } catch (ParseException e) {
              System.out.println("Please ensure you seperate the time with colons eg 07:30:00.");
          }
  
      }
  </code></pre>
  
  <p><strong>Edit 2:</strong> Okay, so now it's really weird. It works for everything I put in except if seconds are equal to 00. I have no idea why it's doing this.</p>