Skip to content

Commit f3e777d

Browse files
committed
refactoring: LeftOptional as decorator
1 parent d7b7e72 commit f3e777d

File tree

6 files changed

+323
-281
lines changed

6 files changed

+323
-281
lines changed

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

Lines changed: 0 additions & 155 deletions
This file was deleted.

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
/**
1010
* A class that acts as a container for a value of one of two types. An Either
1111
* can be either be a "Left", containing a LHS value or a "Right" containing a RHS value,
12-
* but not "none" or "both".
12+
* but it cannot be "neither" or "both".
1313
*
1414
* <p>An Either can be used to express a success or failure case. By convention,
15-
* a Right represents the result of a successful computation,
16-
* and a Left represents some kind of failure value.
15+
* a Right contains the result of a successful computation,
16+
* and a Left contains some kind of failure object.
1717
*
1818
* @param <L> the type of the LHS value
1919
* @param <R> the type of the RHS value
@@ -50,9 +50,9 @@ public static <L, R> Either<L, R> right(R value) {
5050
}
5151

5252
/**
53-
* Returns a collector that accumulates the RHS values in the stream into a Right,
53+
* Returns a collector that accumulates a Right containing all values in the original order,
5454
* if there are no Left instances in the stream.
55-
* If the stream contains a Left, it accumulates a Left containing the first LHS value.
55+
* If the stream contains a Left, it accumulates a Left containing the first LHS value in the stream.
5656
*
5757
* @param <L> the LHS type
5858
* @param <R> the RHS type
@@ -64,9 +64,10 @@ public static <L, R> Either<L, R> right(R value) {
6464
}
6565

6666
/**
67-
* Returns a collector that accumulates a Right containing all RHS values in the original order,
67+
* Returns a collector that accumulates a Right containing all values in the original order,
6868
* if there are no Left instances in the stream.
69-
* If the stream contains a Left, it accumulates a Left containing all LHS values, in the original order.
69+
* If the stream contains a Left, it accumulates a Left containing all LHS values in the stream,
70+
* in the original order.
7071
*
7172
* @param <L> the LHS type
7273
* @param <R> the RHS type

0 commit comments

Comments
 (0)