@SuppressWarnings("unlikely-arg-type") @Test public void testEquals() { final MutableCharArray seq = new MutableCharArray("Dawid Weiss"); assertFalse(seq.equals("Dawid Weiss")); assertTrue(seq.subSequence(1, 5).equals(new MutableCharArray("awid"))); }
@Override public boolean equals(Object other) { if (other == this) return true; if (other instanceof MutableCharArray) { final MutableCharArray otherArray = (MutableCharArray) other; if (this.length == otherArray.length && this.hashCode() == otherArray.hashCode()) { int j = otherArray.start; int k = start; for (int i = this.length - 1; i >= 0; i--, j++, k++) { if (otherArray.buffer[j] != buffer[k]) { return false; } } return true; } } return false; }
MutableCharArray implements CharSequence, Cloneable { @Override public boolean equals(Object other) { if (other == this) return true; if (other instanceof MutableCharArray) { final MutableCharArray otherArray = (MutableCharArray) other; if (this.length == otherArray.length && this.hashCode() == otherArray.hashCode()) { int j = otherArray.start; int k = start; for (int i = this.length - 1; i >= 0; i--, j++, k++) { if (otherArray.buffer[j] != buffer[k]) { return false; } } return true; } } return false; } }
MutableCharArray implements CharSequence, Cloneable { @Override public boolean equals(Object other) { if (other == this) return true; if (other instanceof MutableCharArray) { final MutableCharArray otherArray = (MutableCharArray) other; if (this.length == otherArray.length && this.hashCode() == otherArray.hashCode()) { int j = otherArray.start; int k = start; for (int i = this.length - 1; i >= 0; i--, j++, k++) { if (otherArray.buffer[j] != buffer[k]) { return false; } } return true; } } return false; } MutableCharArray();  MutableCharArray(CharSequence seq);  MutableCharArray(char[] buffer);  MutableCharArray(char[] buffer, int start, int length); }
MutableCharArray implements CharSequence, Cloneable { @Override public boolean equals(Object other) { if (other == this) return true; if (other instanceof MutableCharArray) { final MutableCharArray otherArray = (MutableCharArray) other; if (this.length == otherArray.length && this.hashCode() == otherArray.hashCode()) { int j = otherArray.start; int k = start; for (int i = this.length - 1; i >= 0; i--, j++, k++) { if (otherArray.buffer[j] != buffer[k]) { return false; } } return true; } } return false; } 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(); }
MutableCharArray implements CharSequence, Cloneable { @Override public boolean equals(Object other) { if (other == this) return true; if (other instanceof MutableCharArray) { final MutableCharArray otherArray = (MutableCharArray) other; if (this.length == otherArray.length && this.hashCode() == otherArray.hashCode()) { int j = otherArray.start; int k = start; for (int i = this.length - 1; i >= 0; i--, j++, k++) { if (otherArray.buffer[j] != buffer[k]) { return false; } } return true; } } return false; } 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();  }