How to append two arrays without copying characters???
I need to append two arrays. But I don't know how to append them without copying characters. Can someone help me?
Thx in advance!
Details are listed as following:
public Cord(String init) (constructor)
Create a cord whose content is the string init
public Cord append(Cord other)
Return a cord containing all the characters of the original cord, followed by all of the characters of other. Note that this method should not modify the original cord.
Your implementation must not use the java String class to store the data; the data should be stored in arrays of characters.
To avoid copying, you will need to make each cord be a sequence of “cord segments,” where each cord segment contains an array of characters, plus the index of the first character to use and either the length or the index of the last character to use.