Design a logger system that receives a stream of messages and their timestamps. Each unique message should only be printed at most every 10 seconds.
Implement the Logger class:
boolean shouldPrintMessage(int timestamp, String message)— returnstrueif the message should be printed.
Example:
shouldPrintMessage(1,"foo")→true, shouldPrintMessage(2,"bar")→true, shouldPrintMessage(3,"foo")→false, shouldPrintMessage(8,"bar")→false, shouldPrintMessage(10,"foo")→false, shouldPrintMessage(11,"foo")→true