Last active
September 14, 2017 15:15
-
-
Save yonatanm/af7b009dfed3ba6d06b563363928157f to your computer and use it in GitHub Desktop.
Explain why (r1 == true) and (r2==false) ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set<URL> mySet = new HashSet<>(); | |
mySet.add(new URL("https://my.outbrain.com")); | |
boolean r1 = mySet.contains(new URL("https://my.outbrain.com")); // Returns true | |
System.out.println("r1 = " + r1); | |
Thread.sleep(60 * 1000); // sleeping for 1 minute | |
boolean r2 = mySet.contains(new URL("https://my.outbrain.com")); // Return false | |
System.out.println("r2 = " + r2); | |
// why (r1 != r2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment