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

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(121)

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

Array.ofAll介绍

[英]Creates an Array of the given elements.

The resulting Array has the same iteration order as the given iterable of elements if the iteration order of the elements is stable.
[中]创建给定元素的数组。
如果元素的迭代顺序是稳定的,则生成的数组具有与给定元素iterable相同的迭代顺序。

代码示例

代码示例来源:origin: resilience4j/resilience4j

/**
 * {@inheritDoc}
 */
@Override
public Seq<AsyncRetry> getAllRetries() {
  return Array.ofAll(retries.values());
}

代码示例来源:origin: resilience4j/resilience4j

/**
 * {@inheritDoc}
 */
@Override
public Seq<RateLimiter> getAllRateLimiters() {
  return Array.ofAll(rateLimiters.values());
}

代码示例来源:origin: resilience4j/resilience4j

@Override
public Seq<Bulkhead> getAllBulkheads() {
  return Array.ofAll(bulkheads.values());
}

代码示例来源:origin: resilience4j/resilience4j

@Override
public Seq<CircuitBreaker> getAllCircuitBreakers() {
  return Array.ofAll(circuitBreakers.values());
}

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

@Override
public Tuple2<Array<T>, Array<T>> partition(Predicate<? super T> predicate) {
  Objects.requireNonNull(predicate, "predicate is null");
  final java.util.List<T> left = new ArrayList<>(), right = new ArrayList<>();
  for (T t : this) {
    (predicate.test(t) ? left : right).add(t);
  }
  return Tuple.of(ofAll(left), ofAll(right));
}

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

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

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

/**
 * Creates an Array from int values.
 *
 * @param elements int values
 * @return A new Array of Integer values
 * @throws NullPointerException if elements is null
 */
public static Array<Integer> ofAll(int... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

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

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

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

/**
 * Creates an Array from float values.
 *
 * @param elements float values
 * @return A new Array of Float values
 * @throws NullPointerException if elements is null
 */
public static Array<Float> ofAll(float... elements) {
  Objects.requireNonNull(elements, "elements is null");
  return ofAll(Iterator.ofAll(elements));
}

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

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

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

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

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

@Override
public Array<T> orElse(Iterable<? extends T> other) {
  return isEmpty() ? ofAll(other) : this;
}

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

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

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

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

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

@Override
public Array<T> orElse(Supplier<? extends Iterable<? extends T>> supplier) {
  return isEmpty() ? ofAll(supplier.get()) : this;
}

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

@Override
public <U> Array<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
public <U, R> Array<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
public <U> Array<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

@Override
public <R> Array<R> collect(PartialFunction<? super T, ? extends R> partialFunction) {
  return ofAll(iterator().<R> collect(partialFunction));
}

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

@SuppressWarnings("unchecked")
static <T> T asPrimitives(Class<?> primitiveClass, Iterable<?> values) {
  final Object[] array = Array.ofAll(values).toJavaArray();
  final ArrayType<T> type = of((Class<T>) primitiveClass);
  final Object results = type.newInstance(array.length);
  for (int i = 0; i < array.length; i++) {
    type.setAt(results, i, (T) array[i]);
  }
  return (T) results;
}

相关文章