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

x33g5p2x  于2022-02-01 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(285)

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

Vector.removeAt介绍

暂无

代码示例

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

@Override
public Vector<T> removeFirst(Predicate<T> predicate) {
  Objects.requireNonNull(predicate, "predicate is null");
  for (int i = 0; i < length(); i++) {
    if (predicate.test(get(i))) {
      return removeAt(i);
    }
  }
  return this;
}

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

@Override
public Vector<T> removeLast(Predicate<T> predicate) {
  Objects.requireNonNull(predicate, "predicate is null");
  for (int i = length() - 1; i >= 0; i--) {
    if (predicate.test(get(i))) {
      return removeAt(i);
    }
  }
  return this;
}

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

@Override
public Vector<T> remove(T element) {
  for (int i = 0; i < length(); i++) {
    if (Objects.equals(get(i), element)) {
      return removeAt(i);
    }
  }
  return this;
}

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

@Override
public Vector<T> removeLast(Predicate<T> predicate) {
  Objects.requireNonNull(predicate, "predicate is null");
  for (int i = length() - 1; i >= 0; i--) {
    if (predicate.test(get(i))) {
      return removeAt(i);
    }
  }
  return this;
}

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

@Override
public Vector<T> removeFirst(Predicate<T> predicate) {
  Objects.requireNonNull(predicate, "predicate is null");
  for (int i = 0; i < length(); i++) {
    if (predicate.test(get(i))) {
      return removeAt(i);
    }
  }
  return this;
}

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

@Override
public Vector<T> remove(T element) {
  for (int i = 0; i < length(); i++) {
    if (Objects.equals(get(i), element)) {
      return removeAt(i);
    }
  }
  return this;
}

代码示例来源:origin: martincooper/java-datatable

/**
 * Attempts to remove an existing item at the specified index.
 *
 * @param index The index to remove the item at.
 * @return Returns a Success with the new modified DataColumn, or a Failure.
 */
@Override
public Try<IDataColumn> remove(Integer index) {
  return Try.of(() -> createColumn(this.data.removeAt(index)));
}

代码示例来源:origin: martincooper/java-datatable

/**
 * Removes the item at the specified index.
 *
 * @param index The index to remove the item at.
 * @return Returns a new DataColumn with the specified item removed.
 */
public Try<DataColumn<T>> removeItem(Integer index) {
  return Try.of(() -> createColumn(this.data.removeAt(index)));
}

代码示例来源:origin: martincooper/java-datatable

/**
 * Removes an item from the vector, with additional bounds check.
 *
 * @param vector The vector to remove the item from.
 * @param index The index to remove the item at.
 * @param <T> The vector type.
 * @return Returns the new vector with the item removed.
 */
public static <T> Try<Vector<T>> removeItem(Vector<T> vector, Integer index) {
  return outOfBounds(vector, index)
      ? error("Item index out of bounds for remove.")
      : Try.success(vector.removeAt(index));
}

相关文章