コード例 #1
0
  /** {@inheritDoc} */
  @Nullable
  @Override
  public <T> T value(CacheObjectContext ctx, boolean cpy) {
    if (cpy) return (T) Arrays.copyOf(val, val.length);

    return (T) val;
  }
コード例 #2
0
  /**
   * Concat arrays in one.
   *
   * @param arrays Arrays.
   * @return Summary array.
   */
  public static int[] concat(int[]... arrays) {
    assert arrays != null;
    assert arrays.length > 1;

    int len = 0;

    for (int[] a : arrays) len += a.length;

    int[] r = Arrays.copyOf(arrays[0], len);

    for (int i = 1, shift = 0; i < arrays.length; i++) {
      shift += arrays[i - 1].length;
      System.arraycopy(arrays[i], 0, r, shift, arrays[i].length);
    }

    return r;
  }
コード例 #3
0
    /** @param lsnr Listener. */
    void add(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr) {
      arr = Arrays.copyOf(arr, arr.length + 1);

      arr[arr.length - 1] = lsnr;
    }