trimToSize() StringBuffer Example

When the coding comes to an end with string manipulation in the buffer and further no modification is required, keeping extra buffer is memory waste. To remove the extra buffer than required to hold the characters, Programmer calls this method. What Java API says: public synchronized void trimToSize(): Deletes the extra buffer existing more than …

trimToSize() StringBuffer Example Read More »