We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
in Java, a Set<Characters> means a list of characters without repetition. So, even if you add repeated characters to the set, it will only store different characters.
And when I call:
charSet1.retainAll(charSet2);
charSet1 will be modified to keep only the intersection between itself and charSet2.
Two Strings
You are viewing a single comment's thread. Return to all comments →
in Java, a
Set<Characters>
means a list of characters without repetition. So, even if you add repeated characters to the set, it will only store different characters.And when I call:
charSet1 will be modified to keep only the intersection between itself and charSet2.
More info:
https://docs.oracle.com/javase/7/docs/api/java/util/Set.html https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html