本文整理了Java中io.vavr.Tuple
类的一些代码示例,展示了Tuple
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple
类的具体详情如下:
包路径:io.vavr.Tuple
类名称:Tuple
[英]The base interface of all tuples.
[中]所有元组的基本接口。
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T5> type of the value to append
* @param t5 the value to append
* @return a new Tuple with the value appended
*/
public <T5> Tuple5<T1, T2, T3, T4, T5> append(T5 t5) {
return Tuple.of(_1, _2, _3, _4, t5);
}
代码示例来源:origin: vavr-io/vavr
/**
* Alias for {@link Tuple#empty()}
*
* @return the empty tuple.
*/
public static Tuple0 Tuple() {
return Tuple.empty();
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T1> type of the value to append
* @param t1 the value to append
* @return a new Tuple with the value appended
*/
public <T1> Tuple1<T1> append(T1 t1) {
return Tuple.of(t1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T6> type of the value to append
* @param t6 the value to append
* @return a new Tuple with the value appended
*/
public <T6> Tuple6<T1, T2, T3, T4, T5, T6> append(T6 t6) {
return Tuple.of(_1, _2, _3, _4, _5, t6);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T4> type of the value to append
* @param t4 the value to append
* @return a new Tuple with the value appended
*/
public <T4> Tuple4<T1, T2, T3, T4> append(T4 t4) {
return Tuple.of(_1, _2, _3, t4);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T3> type of the value to append
* @param t3 the value to append
* @return a new Tuple with the value appended
*/
public <T3> Tuple3<T1, T2, T3> append(T3 t3) {
return Tuple.of(_1, _2, t3);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T8> type of the value to append
* @param t8 the value to append
* @return a new Tuple with the value appended
*/
public <T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> append(T8 t8) {
return Tuple.of(_1, _2, _3, _4, _5, _6, _7, t8);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T2> type of the value to append
* @param t2 the value to append
* @return a new Tuple with the value appended
*/
public <T2> Tuple2<T1, T2> append(T2 t2) {
return Tuple.of(_1, t2);
}
代码示例来源:origin: vavr-io/vavr
/**
* Swaps the elements of this {@code Tuple}.
*
* @return A new Tuple where the first element is the second element of this Tuple
* and the second element is the first element of this Tuple.
*/
public Tuple2<T2, T1> swap() {
return Tuple.of(_2, _1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Append a value to this tuple.
*
* @param <T7> type of the value to append
* @param t7 the value to append
* @return a new Tuple with the value appended
*/
public <T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> append(T7 t7) {
return Tuple.of(_1, _2, _3, _4, _5, _6, t7);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T4> the type of the 4th value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T4> Tuple4<T1, T2, T3, T4> concat(Tuple1<T4> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, _2, _3, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T3> the type of the 3rd value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T3> Tuple3<T1, T2, T3> concat(Tuple1<T3> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, _2, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T5> the type of the 5th value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple1<T5> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, _2, _3, _4, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T1> the type of the 1st value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T1> Tuple1<T1> concat(Tuple1<T1> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T7> the type of the 7th value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple1<T7> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, _2, _3, _4, _5, _6, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T8> the type of the 8th value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple1<T8> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, _2, _3, _4, _5, _6, _7, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
/**
* Concat a tuple's values to this tuple.
*
* @param <T2> the type of the 2nd value in the tuple
* @param tuple the tuple to concat
* @return a new Tuple with the tuple values appended
* @throws NullPointerException if {@code tuple} is null
*/
public <T2> Tuple2<T1, T2> concat(Tuple1<T2> tuple) {
Objects.requireNonNull(tuple, "tuple is null");
return Tuple.of(_1, tuple._1);
}
代码示例来源:origin: vavr-io/vavr
private static <T> Tuple2<? extends RedBlackTree<T>, Boolean> blackify(RedBlackTree<T> tree) {
if (tree instanceof Node) {
final Node<T> node = (Node<T>) tree;
if (node.color == RED) {
return Tuple.of(node.color(BLACK), false);
}
}
return Tuple.of(tree, true);
}
代码示例来源:origin: vavr-io/vavr
/**
* Maps the 6th component of this tuple to a new value.
*
* @param <U> new type of the 6th component
* @param mapper A mapping function
* @return a new tuple based on this tuple and substituted 6th component
*/
public <U> Tuple6<T1, T2, T3, T4, T5, U> map6(Function<? super T6, ? extends U> mapper) {
Objects.requireNonNull(mapper, "mapper is null");
final U u = mapper.apply(_6);
return Tuple.of(_1, _2, _3, _4, _5, u);
}
代码示例来源:origin: vavr-io/vavr
/**
* Maps the 1st component of this tuple to a new value.
*
* @param <U> new type of the 1st component
* @param mapper A mapping function
* @return a new tuple based on this tuple and substituted 1st component
*/
public <U> Tuple5<U, T2, T3, T4, T5> map1(Function<? super T1, ? extends U> mapper) {
Objects.requireNonNull(mapper, "mapper is null");
final U u = mapper.apply(_1);
return Tuple.of(u, _2, _3, _4, _5);
}
内容来源于网络,如有侵权,请联系作者删除!