Skip to content

Commit

Permalink
[#131] - ImmutableTreeSet: added missed javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHarmonicMinor committed Jun 26, 2021
1 parent 4d0f022 commit da9c12c
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public final class ImmutableTreeSet<T>

private final NavigableSet<T> navigableSet;

/**
* Creates new {@linkplain ImmutableTreeSet}.
*
* @param iterable source of elements
* @param <R> the type of the element
* @return new {@linkplain ImmutableTreeSet}
* @throws NullPointerException if {@code iterable} is null
*/
public static <R extends Comparable<R>> ImmutableTreeSet<R> of(Iterable<R> iterable) {
Objects.requireNonNull(
iterable,
Expand All @@ -37,6 +45,15 @@ public static <R extends Comparable<R>> ImmutableTreeSet<R> of(Iterable<R> itera
return new ImmutableTreeSet<>(iterable, null);
}

/**
* Creates new {@linkplain ImmutableTreeSet}.
*
* @param iterable source of elements
* @param comparator element's comparator. Might be null
* @param <R> the type of the element
* @return new {@linkplain ImmutableTreeSet}
* @throws NullPointerException if {@code iterable} is null
*/
public static <R> ImmutableTreeSet<R> of(Iterable<R> iterable, Comparator<R> comparator) {
Objects.requireNonNull(
iterable,
Expand All @@ -45,6 +62,14 @@ public static <R> ImmutableTreeSet<R> of(Iterable<R> iterable, Comparator<R> com
return new ImmutableTreeSet<>(iterable, comparator);
}

/**
* Creates new {@linkplain ImmutableTreeSet}.
*
* @param sortedSet source of elements
* @param <R> the type of the element
* @return new {@linkplain ImmutableTreeSet}
* @throws NullPointerException if {@code sortedSet} is null
*/
public static <R> ImmutableTreeSet<R> ofSortedSet(SortedSet<R> sortedSet) {
Objects.requireNonNull(
sortedSet,
Expand All @@ -53,6 +78,13 @@ public static <R> ImmutableTreeSet<R> ofSortedSet(SortedSet<R> sortedSet) {
return new ImmutableTreeSet<>(sortedSet);
}

/**
* Constructor.
*
* @param iterable source of elements
* @param comparator element's comparator. Might be null.
* @throws NullPointerException if {@code iterable} is null
*/
ImmutableTreeSet(Iterable<T> iterable, Comparator<? super T> comparator) {
Objects.requireNonNull(
iterable,
Expand All @@ -64,6 +96,12 @@ public static <R> ImmutableTreeSet<R> ofSortedSet(SortedSet<R> sortedSet) {
}
}

/**
* Constructor.
*
* @param sortedSet source of elements
* @throws NullPointerException if {@code sortedSet} is null
*/
ImmutableTreeSet(SortedSet<T> sortedSet) {
Objects.requireNonNull(
sortedSet,
Expand Down

0 comments on commit da9c12c

Please sign in to comment.