Node<V> build() {
            // Build the `children` while looking for `parameterChild` and `catchAllChild`.
            final Char2ObjectMap<Node<V>> children;
            Node<V> parameterChild = null;
            Node<V> catchAllChild = null;
            if (this.children == null || this.children.isEmpty()) {
                children = Char2ObjectMaps.emptyMap();
            } else {
                final Char2ObjectMap<Node<V>> newChildren = new Char2ObjectOpenHashMap<>(this.children.size());
                for (Char2ObjectMap.Entry<NodeBuilder<V>> e : this.children.char2ObjectEntrySet()) {
                    final Node<V> newChild = e.getValue().build();
                    switch (newChild.type) {
                        case PARAMETER:
                            if (parameterChild == null) {
                                parameterChild = newChild;
                            }
                            break;
                        case CATCH_ALL:
                            if (catchAllChild == null) {
                                catchAllChild = newChild;
                            }
                            break;
                    }

                    newChildren.put(e.getCharKey(), newChild);
                }
                children = Char2ObjectMaps.unmodifiable(newChildren);
            }

            // Build the `values` by concatenating `valuesWithHighPrecedence` and `valuesWithLowPrecedence`.
            final List<V> values;
            if (valuesWithHighPrecedence == null) {
                if (valuesWithLowPrecedence == null) {
                    values = ImmutableList.of();
                } else {
                    values = ImmutableList.copyOf(valuesWithLowPrecedence);
                }
            } else {
                if (valuesWithLowPrecedence == null) {
                    values = ImmutableList.copyOf(valuesWithHighPrecedence);
                } else {
                    final ImmutableList.Builder<V> builder = ImmutableList.builderWithExpectedSize(
                            valuesWithHighPrecedence.size() + valuesWithLowPrecedence.size());
                    values = builder.addAll(valuesWithHighPrecedence)
                                    .addAll(valuesWithLowPrecedence)
                                    .build();
                }
            }

            return new Node<>(type, path, children, parameterChild, catchAllChild, values);
        }
Splits this {@link RoutingTrie.Node} into two by the given index of the path.
core/src/main/java/com/linecorp/armeria/server/RoutingTrieBuilder.java