本文整理了Java中org.apache.flink.types.Either.isRight()
方法的一些代码示例,展示了Either.isRight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Either.isRight()
方法的具体详情如下:
包路径:org.apache.flink.types.Either
类名称:Either
方法名:isRight
暂无
代码示例来源:origin: apache/flink
public void flatMap(Either<Vertex<K, VV>, Tuple2<K, Message>> value,
Collector<Tuple2<K, Either<NullValue, Message>>> out) {
if (value.isRight()) {
Tuple2<K, Message> message = value.right();
outTuple.f0 = message.f0;
outTuple.f1 = Either.Right(message.f1);
out.collect(outTuple);
}
}
}
代码示例来源:origin: apache/flink
/**
* Utility function for {@link EitherSerializer} to support object reuse.
*
* To support object reuse both subclasses of Either contain a reference to
* an instance of the other type. This method provides access to and
* initializes the cross-reference.
*
* @param input container for Left or Right value
* @param rightSerializer for creating an instance of the right type
* @param <L>
* the type of Left
* @param <R>
* the type of Right
* @return input if Right type else input's Right reference
*/
@Internal
public static <L, R> Right<L, R> obtainRight(Either<L, R> input, TypeSerializer<R> rightSerializer) {
if (input.isRight()) {
return (Right<L, R>) input;
} else {
Left<L, R> left = (Left<L, R>) input;
if (left.right == null) {
left.right = Right.of(rightSerializer.createInstance());
left.right.left = left;
}
return left.right;
}
}
}
代码示例来源:origin: org.apache.flink/flink-gelly_2.11
public void flatMap(Either<Vertex<K, VV>, Tuple2<K, Message>> value,
Collector<Tuple2<K, Either<NullValue, Message>>> out) {
if (value.isRight()) {
Tuple2<K, Message> message = value.right();
outTuple.f0 = message.f0;
outTuple.f1 = Either.Right(message.f1);
out.collect(outTuple);
}
}
}
代码示例来源:origin: org.apache.flink/flink-gelly_2.10
public void flatMap(Either<Vertex<K, VV>, Tuple2<K, Message>> value,
Collector<Tuple2<K, Either<NullValue, Message>>> out) {
if (value.isRight()) {
Tuple2<K, Message> message = value.right();
outTuple.f0 = message.f0;
outTuple.f1 = Either.Right(message.f1);
out.collect(outTuple);
}
}
}
代码示例来源:origin: com.alibaba.blink/flink-gelly
public void flatMap(Either<Vertex<K, VV>, Tuple2<K, Message>> value,
Collector<Tuple2<K, Either<NullValue, Message>>> out) {
if (value.isRight()) {
Tuple2<K, Message> message = value.right();
outTuple.f0 = message.f0;
outTuple.f1 = Either.Right(message.f1);
out.collect(outTuple);
}
}
}
代码示例来源:origin: org.apache.flink/flink-core
/**
* Utility function for {@link EitherSerializer} to support object reuse.
*
* To support object reuse both subclasses of Either contain a reference to
* an instance of the other type. This method provides access to and
* initializes the cross-reference.
*
* @param input container for Left or Right value
* @param rightSerializer for creating an instance of the right type
* @param <L>
* the type of Left
* @param <R>
* the type of Right
* @return input if Right type else input's Right reference
*/
@Internal
public static <L, R> Right<L, R> obtainRight(Either<L, R> input, TypeSerializer<R> rightSerializer) {
if (input.isRight()) {
return (Right<L, R>) input;
} else {
Left<L, R> left = (Left<L, R>) input;
if (left.right == null) {
left.right = Right.of(rightSerializer.createInstance());
left.right.left = left;
}
return left.right;
}
}
}
代码示例来源:origin: com.alibaba.blink/flink-core
/**
* Utility function for {@link EitherSerializer} to support object reuse.
*
* To support object reuse both subclasses of Either contain a reference to
* an instance of the other type. This method provides access to and
* initializes the cross-reference.
*
* @param input container for Left or Right value
* @param rightSerializer for creating an instance of the right type
* @param <L>
* the type of Left
* @param <R>
* the type of Right
* @return input if Right type else input's Right reference
*/
@Internal
public static <L, R> Right<L, R> obtainRight(Either<L, R> input, TypeSerializer<R> rightSerializer) {
if (input.isRight()) {
return (Right<L, R>) input;
} else {
Left<L, R> left = (Left<L, R>) input;
if (left.right == null) {
left.right = Right.of(rightSerializer.createInstance());
left.right.left = left;
}
return left.right;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!