MCPcopy Create free account
hub / github.com/davidgiven/luje / contentEquals

Method contentEquals

lib/java/lang/String.java:1709–1721  ·  view source on GitHub ↗

Compares a CharSequence to this String to determine if their contents are equal. @param cs the character sequence to compare to. @return true if equal, otherwise false @since 1.5

(CharSequence cs)

Source from the content-addressed store, hash-verified

1707 * @since 1.5
1708 */
1709 public boolean contentEquals(CharSequence cs) {
1710 int len = cs.length();
1711
1712 if (len != count) {
1713 return false;
1714 }
1715
1716 if (len == 0 && count == 0) {
1717 return true; // since both are empty strings
1718 }
1719
1720 return regionMatches(0, cs.toString(), 0, len);
1721 }
1722
1723 /**
1724 * Determines whether this string matches a given regular expression.

Callers

nothing calls this directly

Calls 3

regionMatchesMethod · 0.95
lengthMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected