Skip to content

Commit 7040cc0

Browse files
committed
[java] Code cleanup
1 parent 38ddb37 commit 7040cc0

File tree

1 file changed

+9
-9
lines changed
  • java/client/src/org/openqa/selenium/internal

1 file changed

+9
-9
lines changed

java/client/src/org/openqa/selenium/internal/Either.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
package org.openqa.selenium.internal;
1919

2020
public class Either<A, B> {
21-
private A left = null;
22-
private B right = null;
21+
private final A left;
22+
private final B right;
2323

2424
private Either(A a, B b) {
2525
left = a;
2626
right = b;
2727
}
2828

2929
public static <A, B> Either<A, B> left(A a) {
30-
return new Either<A, B>(a, null);
30+
return new Either<>(a, null);
3131
}
3232

33-
public A left() {
34-
return left;
33+
public static <A, B> Either<A, B> right(B b) {
34+
return new Either<>(null, b);
3535
}
3636

3737
public boolean isLeft() {
@@ -42,11 +42,11 @@ public boolean isRight() {
4242
return right != null;
4343
}
4444

45-
public B right() {
46-
return right;
45+
public A left() {
46+
return left;
4747
}
4848

49-
public static <A, B> Either<A, B> right(B b) {
50-
return new Either<A, B>(null, b);
49+
public B right() {
50+
return right;
5151
}
5252
}

0 commit comments

Comments
 (0)