Closed ZeroMoreFree closed 6 years ago
Ah, now I get it. What you are saying is, that since the while-loop above will either continue running until capacity > length + remaining (or return -1 if expansion fails), by the time the while loop exits and we get to copying the bytes, it is guaranteed that length + remaining < capacity, so there will always be space for the bytes from the ByteBuffer in the ResizableArrayBuffer...
You are right! Thanks! :-)
That's exactly what I want to say. Thank you for your reply. It's a good tutorial
Merged in! Thanks again! :-)
since the loop "while(length + remaining > capacity)" will return -1 or let the capacity > length + remaining
then if the program is not return -1 , "capacity - length > remaining " come into existence so it is no need for you to use the Math.min function to get a result