@@ -35,99 +35,96 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
3535 private static final long serialVersionUID = -5820772575483504339L ;
3636
3737 /**
38- * The comparator to use when comparing two non-{@code null} objects.
39- ** /
38+ * The comparator to use when comparing two non-{@code null} objects.
39+ */
4040 private final Comparator <? super E > nonNullComparator ;
4141
4242 /**
43- * Specifies whether a {@code null} are compared as higher than
44- * non-{@code null} objects.
45- ** /
43+ * Specifies whether a {@code null} are compared as higher than
44+ * non-{@code null} objects.
45+ */
4646 private final boolean nullsAreHigh ;
4747
4848 /**
49- * Construct an instance that sorts {@code null} higher than any
50- * non-{@code null} object it is compared with. When comparing two
51- * non-{@code null} objects, the {@link ComparableComparator} is
52- * used.
53- ** /
49+ * Construct an instance that sorts {@code null} higher than any
50+ * non-{@code null} object it is compared with. When comparing two
51+ * non-{@code null} objects, the {@link ComparableComparator} is
52+ * used.
53+ */
5454 public NullComparator () {
5555 this (ComparatorUtils .NATURAL_COMPARATOR , true );
5656 }
5757
5858 /**
59- * Construct an instance that sorts {@code null} higher or lower than
60- * any non-{@code null} object it is compared with. When comparing
61- * two non-{@code null} objects, the {@link ComparableComparator} is
62- * used.
59+ * Construct an instance that sorts {@code null} higher or lower than
60+ * any non-{@code null} object it is compared with. When comparing
61+ * two non-{@code null} objects, the {@link ComparableComparator} is
62+ * used.
6363 *
64- * @param nullsAreHigh a {@code true} value indicates that
65- * {@code null} should be compared as higher than a
66- * non-{@code null} object. A {@code false} value indicates
67- * that {@code null} should be compared as lower than a
68- * non-{@code null} object.
69- ** /
64+ * @param nullsAreHigh a {@code true} value indicates that
65+ * {@code null} should be compared as higher than a
66+ * non-{@code null} object. A {@code false} value indicates
67+ * that {@code null} should be compared as lower than a
68+ * non-{@code null} object.
69+ */
7070 public NullComparator (final boolean nullsAreHigh ) {
7171 this (ComparatorUtils .NATURAL_COMPARATOR , nullsAreHigh );
7272 }
7373
7474 /**
75- * Construct an instance that sorts {@code null} higher than any
76- * non-{@code null} object it is compared with. When comparing two
77- * non-{@code null} objects, the specified {@link Comparator} is
78- * used.
75+ * Construct an instance that sorts {@code null} higher than any
76+ * non-{@code null} object it is compared with. When comparing two
77+ * non-{@code null} objects, the specified {@link Comparator} is
78+ * used.
7979 *
80- * @param nonNullComparator the comparator to use when comparing two
81- * non-{@code null} objects. This argument cannot be
82- * {@code null}
83- *
84- * @throws NullPointerException if {@code nonNullComparator} is
85- * {@code null}
86- **/
80+ * @param nonNullComparator the comparator to use when comparing two
81+ * non-{@code null} objects. This argument cannot be
82+ * {@code null}
83+ * @throws NullPointerException if {@code nonNullComparator} is
84+ * {@code null}
85+ */
8786 public NullComparator (final Comparator <? super E > nonNullComparator ) {
8887 this (nonNullComparator , true );
8988 }
9089
9190 /**
92- * Construct an instance that sorts {@code null} higher or lower than
93- * any non-{@code null} object it is compared with. When comparing
94- * two non-{@code null} objects, the specified {@link Comparator} is
95- * used.
96- *
97- * @param nonNullComparator the comparator to use when comparing two
98- * non-{@code null} objects. This argument cannot be
99- * {@code null}
91+ * Construct an instance that sorts {@code null} higher or lower than
92+ * any non-{@code null} object it is compared with. When comparing
93+ * two non-{@code null} objects, the specified {@link Comparator} is
94+ * used.
10095 *
101- * @param nullsAreHigh a {@code true} value indicates that
102- * {@code null} should be compared as higher than a
103- * non-{@code null} object. A {@code false} value indicates
104- * that {@code null} should be compared as lower than a
105- * non-{@code null} object.
106- *
107- * @throws NullPointerException if {@code nonNullComparator} is
108- * {@code null}
109- **/
96+ * @param nonNullComparator the comparator to use when comparing two
97+ * non-{@code null} objects. This argument cannot be
98+ * {@code null}
99+ * @param nullsAreHigh a {@code true} value indicates that
100+ * {@code null} should be compared as higher than a
101+ * non-{@code null} object. A {@code false} value indicates
102+ * that {@code null} should be compared as lower than a
103+ * non-{@code null} object.
104+ * @throws NullPointerException if {@code nonNullComparator} is
105+ * {@code null}
106+ */
110107 public NullComparator (final Comparator <? super E > nonNullComparator , final boolean nullsAreHigh ) {
111108 this .nonNullComparator = Objects .requireNonNull (nonNullComparator , "nonNullComparator" );
112109 this .nullsAreHigh = nullsAreHigh ;
113110 }
114111
115112 /**
116- * Perform a comparison between two objects. If both objects are
117- * {@code null}, a {@code 0} value is returned. If one object
118- * is {@code null} and the other is not, the result is determined on
119- * whether the Comparator was constructed to have nulls as higher or lower
120- * than other objects. If neither object is {@code null}, an
121- * underlying comparator specified in the constructor (or the default) is
122- * used to compare the non-{@code null} objects.
113+ * Perform a comparison between two objects. If both objects are
114+ * {@code null}, a {@code 0} value is returned. If one object
115+ * is {@code null} and the other is not, the result is determined on
116+ * whether the Comparator was constructed to have nulls as higher or lower
117+ * than other objects. If neither object is {@code null}, an
118+ * underlying comparator specified in the constructor (or the default) is
119+ * used to compare the non-{@code null} objects.
123120 *
124- * @param o1 the first object to compare
125- * @param o2 the object to compare it to.
126- * @return {@code -1} if {@code o1} is "lower" than (less than,
127- * before, etc.) {@code o2}; {@code 1} if {@code o1} is
128- * "higher" than (greater than, after, etc.) {@code o2}; or
129- * {@code 0} if {@code o1} and {@code o2} are equal.
130- ** /
121+ * @param o1 the first object to compare
122+ * @param o2 the object to compare it to.
123+ * @return {@code -1} if {@code o1} is "lower" than (less than,
124+ * before, etc.) {@code o2}; {@code 1} if {@code o1} is
125+ * "higher" than (greater than, after, etc.) {@code o2}; or
126+ * {@code 0} if {@code o1} and {@code o2} are equal.
127+ */
131128 @ Override
132129 public int compare (final E o1 , final E o2 ) {
133130 if (o1 == o2 ) {
@@ -143,16 +140,15 @@ public int compare(final E o1, final E o2) {
143140 }
144141
145142 /**
146- * Determines whether the specified object represents a comparator that is
147- * equal to this comparator.
148- *
149- * @param obj the object to compare this comparator with.
143+ * Determines whether the specified object represents a comparator that is
144+ * equal to this comparator.
150145 *
151- * @return {@code true} if the specified object is a NullComparator
152- * with equivalent {@code null} comparison behavior
153- * (i.e. {@code null} high or low) and with equivalent underlying
154- * non-{@code null} object comparators.
155- **/
146+ * @param obj the object to compare this comparator with.
147+ * @return {@code true} if the specified object is a NullComparator
148+ * with equivalent {@code null} comparison behavior
149+ * (i.e. {@code null} high or low) and with equivalent underlying
150+ * non-{@code null} object comparators.
151+ */
156152 @ Override
157153 public boolean equals (final Object obj ) {
158154 if (obj == null ) {
@@ -172,11 +168,11 @@ public boolean equals(final Object obj) {
172168 }
173169
174170 /**
175- * Implement a hash code for this comparator that is consistent with
176- * {@link #equals(Object)}.
171+ * Implement a hash code for this comparator that is consistent with
172+ * {@link #equals(Object)}.
177173 *
178- * @return a hash code for this comparator.
179- ** /
174+ * @return a hash code for this comparator.
175+ */
180176 @ Override
181177 public int hashCode () {
182178 return (nullsAreHigh ? -1 : 1 ) * nonNullComparator .hashCode ();
0 commit comments