private static < K , V > HamtPMap < K , V > [ ] replaceChild ( HamtPMap < K , V > [ ] children , int index , HamtPMap < K , V > child ) { HamtPMap < K , V > [ ] newChildren = Arrays . copyOf ( children , children . length ) ; newChildren [ index ] = child ; return newChildren ; }
Returns a new array of children with the child at the given index replaced .