@Override final Node.Builder<Integer> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Integer[]> generator) { return Nodes.intBuilder(exactSizeIfKnown); }
@Override final Node.Builder<Integer> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Integer[]> generator) { return Nodes.intBuilder(exactSizeIfKnown); }
/** * Produces a {@link Node.Builder.OfInt}. * * @param exactSizeIfKnown -1 if a variable size builder is requested, * otherwise the exact capacity desired. A fixed capacity builder will * fail if the wrong number of elements are added to the builder. * @return a {@code Node.Builder.OfInt} */ static Node.Builder.OfInt intBuilder(long exactSizeIfKnown) { return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE) ? new IntFixedNodeBuilder(exactSizeIfKnown) : intBuilder(); }
/** * Produces a {@link Node.Builder.OfInt}. * * @param exactSizeIfKnown -1 if a variable size builder is requested, * otherwise the exact capacity desired. A fixed capacity builder will * fail if the wrong number of elements are added to the builder. * @return a {@code Node.Builder.OfInt} */ static Node.Builder.OfInt intBuilder(long exactSizeIfKnown) { return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE) ? new IntFixedNodeBuilder(exactSizeIfKnown) : intBuilder(); }
static Node.OfInt truncate(Node.OfInt this_, long from, long to, IntFunction<Integer[]> generator) { if (from == 0 && to == this_.count()) return this_; long size = to - from; Spliterator.OfInt spliterator = this_.spliterator(); Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size); nodeBuilder.begin(size); for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { } if (to == this_.count()) { spliterator.forEachRemaining((IntConsumer) nodeBuilder); } else { for (int i = 0; i < size && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { } } nodeBuilder.end(); return nodeBuilder.build(); }
static Node.OfInt truncate(Node.OfInt this_, long from, long to, IntFunction<Integer[]> generator) { if (from == 0 && to == this_.count()) return this_; long size = to - from; Spliterator.OfInt spliterator = this_.spliterator(); Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size); nodeBuilder.begin(size); for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { } if (to == this_.count()) { spliterator.forEachRemaining((IntConsumer) nodeBuilder); } else { for (int i = 0; i < size && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { } } nodeBuilder.end(); return nodeBuilder.build(); }