Last active
December 6, 2018 21:55
-
-
Save Abhishek-Chaudhary-InfoCepts/d7a1d09e6694cd21dec74defcf7c0d4b to your computer and use it in GitHub Desktop.
Snippets
This file contains 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
/** | |
* Constructs a new, empty tree set, sorted according to the specified | |
* comparator. All elements inserted into the set must be <i>mutually | |
* comparable</i> by the specified comparator: {@code comparator.compare(e1, | |
* e2)} must not throw a {@code ClassCastException} for any elements | |
* {@code e1} and {@code e2} in the set. If the user attempts to add | |
* an element to the set that violates this constraint, the | |
* {@code add} call will throw a {@code ClassCastException}. | |
* | |
* @param comparator the comparator that will be used to order this set. | |
* If {@code null}, the {@linkplain Comparable natural | |
* ordering} of the elements will be used. | |
*/ | |
public TreeSet(Comparator<? super E> comparator) { | |
this(new TreeMap<>(comparator)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment