it.unimi.dsi.fastutil.Arrays.ensureFromTo()方法的使用及代码示例

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

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

Arrays.ensureFromTo介绍

[英]Ensures that a range given by its first (inclusive) and last (exclusive) elements fits an array of given length.

This method may be used whenever an array range check is needed.
[中]确保由其第一个(包含)和最后一个(独占)元素给定的范围适合给定长度的数组。
只要需要阵列范围检查,就可以使用此方法。

代码示例

代码示例来源:origin: apache/geode

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from the start index (inclusive).
 * @param to the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
 it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
 System.arraycopy(a, to, a, from, size - to);
 size -= (to - from);
 int i = to - from;
 while (i-- != 0)
  a[size + i] = null;
}

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

/** Ensures that a range given by its first (inclusive) and last (exclusive) elements fits an array.
  *
  * <P>This method may be used whenever an array range check is needed.
  *
  * @param a an array.
  * @param from a start index (inclusive).
  * @param to an end index (inclusive).
  * @throws IllegalArgumentException if <code>from</code> is greater than <code>to</code>.
  * @throws ArrayIndexOutOfBoundsException if <code>from</code> or <code>to</code> are greater than the array length or negative.
  */
public static void ensureFromTo( final boolean[] a, final int from, final int to ) {
Arrays.ensureFromTo( a.length, from, to );
}
/** Ensures that a range given by an offset and a length fits an array.

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final long[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final boolean[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static <K> void ensureFromTo(final K[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final int[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final float[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final double[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Ensures that a range given by its first (inclusive) and last (exclusive)
 * elements fits an array.
 *
 * <p>
 * This method may be used whenever an array range check is needed.
 *
 * @param a
 *            an array.
 * @param from
 *            a start index (inclusive).
 * @param to
 *            an end index (exclusive).
 * @throws IllegalArgumentException
 *             if {@code from} is greater than {@code to}.
 * @throws ArrayIndexOutOfBoundsException
 *             if {@code from} or {@code to} are greater than the array length
 *             or negative.
 */
public static void ensureFromTo(final byte[] a, final int from, final int to) {
  Arrays.ensureFromTo(a.length, from, to);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: org.apache.geode/gemfire-core

/** Removes elements of this type-specific list using optimized system calls.
  *
  * @param from the start index (inclusive).
  * @param to the end index (exclusive).
  */
public void removeElements( final int from, final int to ) {
it.unimi.dsi.fastutil.Arrays.ensureFromTo( size, from, to );
System.arraycopy( a, to, a, from, size - to );
size -= ( to - from );
int i = to - from;
while( i-- != 0 ) a[ size + i ] = null;
}
/** Adds elements to this type-specific list using optimized system calls.

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
  int i = to - from;
  while (i-- != 0)
    a[size + i] = null;
}
/**

代码示例来源:origin: it.unimi.dsi/fastutil

/**
 * Removes elements of this type-specific list using optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param to
 *            the end index (exclusive).
 */
@Override
public void removeElements(final int from, final int to) {
  it.unimi.dsi.fastutil.Arrays.ensureFromTo(size, from, to);
  System.arraycopy(a, to, a, from, size - to);
  size -= (to - from);
  int i = to - from;
  while (i-- != 0)
    a[size + i] = null;
}
/**

相关文章