File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -11,24 +11,14 @@ public static class Solution1 {
1111 class Logger {
1212
1313 private Map <String , Integer > map ;
14- private Set <String > set ;
1514
16- /**
17- * Initialize your data structure here.
18- */
1915 public Logger () {
20- map = new HashMap <String , Integer >();
21- set = new HashSet <String >();
16+ map = new HashMap <>();
2217 }
2318
24- /**
25- * Returns true if the message should be printed in the given timestamp, otherwise returns
26- * false. The timestamp is in seconds granularity.
27- */
2819 public boolean shouldPrintMessage (int timestamp , String message ) {
29- if (!set . contains (message )) {
20+ if (!map . containsKey (message )) {
3021 map .put (message , timestamp );
31- set .add (message );
3222 return true ;
3323 } else {
3424 if (timestamp - map .get (message ) < 10 ) {
You can’t perform that action at this time.
0 commit comments