comparison src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/util/DefaultEither.java @ 23:3ef2a66a8c5d

commit
author Shoshi TAMAKI
date Thu, 10 Jan 2013 23:22:42 +0900
parents 9fd57b7c6adb
children 7d78bbf4a9cd
comparison
equal deleted inserted replaced
22:9fd57b7c6adb 23:3ef2a66a8c5d
3 public class DefaultEither<A,B> implements Either<A,B> 3 public class DefaultEither<A,B> implements Either<A,B>
4 { 4 {
5 private final A theA; 5 private final A theA;
6 private final B theB; 6 private final B theB;
7 7
8 public DefaultEither(A _theA) 8 private DefaultEither(A _theA,B _theB)
9 { 9 {
10 theA = _theA; 10 theA = _theA;
11 theB = null; 11 theB = _theB;
12 }
13
14 public static final <A,B> DefaultEither<A,B> newA(A _theA)
15 {
16 return new DefaultEither<A,B>(_theA,null);
17 }
18
19 public static final <A,B> DefaultEither<A,B> newB(B _theB)
20 {
21 return new DefaultEither<A,B>(null,_theB);
12 } 22 }
13 23
14 @Override 24 @Override
15 public A a() 25 public A a()
16 { 26 {