io.vavr.collection.List.ofAll()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中io.vavr.collection.List.ofAll()方法的一些代码示例,展示了List.ofAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.ofAll()方法的具体详情如下:
包路径:io.vavr.collection.List
类名称:List
方法名:ofAll

List.ofAll介绍

[英]Creates a List of the given elements.

The resulting list has the same iteration order as the given iterable of elements if the iteration order of the elements is stable.
[中]

代码示例

代码示例来源:origin: vavr-io/vavr

@SuppressWarnings("unchecked")
  private static <T> LinearSeq<T> toLinearSeq(Iterable<? extends T> iterable) {
    return (iterable instanceof LinearSeq) ? (LinearSeq<T>) iterable : List.ofAll(iterable);
  }
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from char values.
 *
 * @param elements char values
 * @return A new List of Character values
 * @throws NullPointerException if elements is null
 */
static List<Character> ofAll(char... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from short values.
 *
 * @param elements short values
 * @return A new List of Short values
 * @throws NullPointerException if elements is null
 */
static List<Short> ofAll(short... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from int values.
 *
 * @param elements int values
 * @return A new Queue of Integer values
 * @throws NullPointerException if elements is null
 */
public static Queue<Integer> ofAll(int... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from double values.
 *
 * @param elements double values
 * @return A new List of Double values
 * @throws NullPointerException if elements is null
 */
static List<Double> ofAll(double... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from long values.
 *
 * @param elements long values
 * @return A new List of Long values
 * @throws NullPointerException if elements is null
 */
static List<Long> ofAll(long... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from double values.
 *
 * @param elements double values
 * @return A new Queue of Double values
 * @throws NullPointerException if elements is null
 */
public static Queue<Double> ofAll(double... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Returns a new Node containing the given value and having the given children.
 *
 * @param value    A value
 * @param children The child nodes, possibly empty
 * @param <T>      Value type
 * @return A new Node instance.
 */
static <T> Node<T> of(T value, Iterable<Node<T>> children) {
  Objects.requireNonNull(children, "children is null");
  return new Node<>(value, io.vavr.collection.List.ofAll(children));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from byte values.
 *
 * @param elements byte values
 * @return A new List of Byte values
 * @throws NullPointerException if elements is null
 */
static List<Byte> ofAll(byte... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from char values.
 *
 * @param elements char values
 * @return A new Queue of Character values
 * @throws NullPointerException if elements is null
 */
public static Queue<Character> ofAll(char... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from short values.
 *
 * @param elements short values
 * @return A new Queue of Short values
 * @throws NullPointerException if elements is null
 */
public static Queue<Short> ofAll(short... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a List from boolean values.
 *
 * @param elements boolean values
 * @return A new List of Boolean values
 * @throws NullPointerException if elements is null
 */
static List<Boolean> ofAll(boolean... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from boolean values.
 *
 * @param elements boolean values
 * @return A new Queue of Boolean values
 * @throws NullPointerException if elements is null
 */
public static Queue<Boolean> ofAll(boolean... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from byte values.
 *
 * @param elements byte values
 * @return A new Queue of Byte values
 * @throws NullPointerException if elements is null
 */
public static Queue<Byte> ofAll(byte... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue from float values.
 *
 * @param elements float values
 * @return A new Queue of Float values
 * @throws NullPointerException if elements is null
 */
public static Queue<Float> ofAll(float... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(io.vavr.collection.List.ofAll(elements));
}

代码示例来源:origin: vavr-io/vavr

@Override
default <U, R> List<R> zipWith(Iterable<? extends U> that, BiFunction<? super T, ? super U, ? extends R> mapper) {
  Objects.requireNonNull(that, "that is null");
  Objects.requireNonNull(mapper, "mapper is null");
  return ofAll(iterator().zipWith(that, mapper));
}

代码示例来源:origin: vavr-io/vavr

@Override
default <U> List<Tuple2<T, U>> zipAll(Iterable<? extends U> that, T thisElem, U thatElem) {
  Objects.requireNonNull(that, "that is null");
  return ofAll(iterator().zipAll(that, thisElem, thatElem));
}

代码示例来源:origin: vavr-io/vavr

@Override
default <U> List<U> zipWithIndex(BiFunction<? super T, ? super Integer, ? extends U> mapper) {
  Objects.requireNonNull(mapper, "mapper is null");
  return ofAll(iterator().zipWithIndex(mapper));
}

代码示例来源:origin: vavr-io/vavr

/**
 * Creates a Queue that contains the elements of the given {@link java.util.stream.Stream}.
 *
 * @param javaStream A {@link java.util.stream.Stream}
 * @param <T>        Component type of the Stream.
 * @return A Queue containing the given elements in the same order.
 */
public static <T> Queue<T> ofAll(java.util.stream.Stream<? extends T> javaStream) {
  Objects.requireNonNull(javaStream, "javaStream is null");
  return new Queue<>(io.vavr.collection.List.ofAll(javaStream), io.vavr.collection.List.empty());
}

代码示例来源:origin: vavr-io/vavr

@Override
default List<T> dropRight(int n) {
  if (n <= 0) {
    return this;
  }
  if (n >= length()) {
    return empty();
  }
  return ofAll(iterator().dropRight(n));
}

相关文章