MutableCharArray implements CharSequence, Cloneable { public void reset(CharSequence seq) { if (buffer == null || buffer.length < seq.length()) { buffer = new char[seq.length()]; } this.length = seq.length(); this.start = 0; for (int i = 0; i < length; i++) { buffer[i] = seq.charAt(i); } this.hash = hashCode(buffer, start, length); } MutableCharArray();  MutableCharArray(CharSequence seq);  MutableCharArray(char[] buffer);  MutableCharArray(char[] buffer, int start, int length); void reset(CharSequence seq); void reset(char[] buffer); void reset(char[] buffer, int start, int length); char[] getBuffer(); int getStart(); final char charAt(final int index); int length(); MutableCharArray subSequence(int start, int end); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); static final int hashCode(final char[] buffer, int start, int length); MutableCharArray clone(); char[] toArray();  }
@Test public void testReset() { final MutableCharArray seq = new MutableCharArray("Dawid Weiss"); assertEquals(seq.toString(), "Dawid Weiss"); seq.reset("Abcdef"); assertEquals(seq.toString(), "Abcdef"); seq.reset("Dawid Weiss".toCharArray(), 1, 3); assertEquals(seq, new MutableCharArray("awi")); seq.reset("abc"); int h1 = seq.hashCode(); seq.reset("def"); int h2 = seq.hashCode(); assertTrue(h1 != h2); }