Skip to content

Commit 6548c10

Browse files
committed
add javadoc
1 parent 19253b7 commit 6548c10

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/java/io/jbock/util/Either.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,20 @@ public static <L, R> Either<L, R> right(R value) {
8282
* If the provided list is empty, returns an empty {@link Optional}.
8383
* Otherwise, returns an {@code Optional} containing the list.
8484
*
85-
* @param failures a failures
86-
* @param <L> the type of the members of the failures
87-
* @return an {@code Optional} which is empty if and only if {@code failures}
85+
* <p>This utility method can sometimes be used to express a
86+
* {@link #filter(Function)} operation more efficiently.
87+
*
88+
* @param values a list of objects
89+
* @param <T> the type of the members of {@code values}
90+
* @return an {@code Optional} which is empty if and only if {@code values}
8891
* is empty
8992
*/
90-
public static <L> Optional<List<L>> optionalList(List<? extends L> failures) {
91-
if (failures.isEmpty()) {
93+
public static <T> Optional<List<T>> optionalList(List<? extends T> values) {
94+
if (values.isEmpty()) {
9295
return Optional.empty();
9396
}
9497
@SuppressWarnings("unchecked")
95-
List<L> result = (List<L>) failures;
98+
List<T> result = (List<T>) values;
9699
return Optional.of(result);
97100
}
98101

0 commit comments

Comments
 (0)