Returns true if a and b are equal, including if they are both null. Note: In platform versions 1.1 and earlier, this method only worked well if both the arguments were instances of String. @param a first CharSequence to check @param b second CharSequence to check @return true if a and
(CharSequence a, CharSequence b)
| 47 | * "Inner assignments should be avoided" |
| 48 | */ |
| 49 | static boolean equals(CharSequence a, CharSequence b) { |
| 50 | if (a == b) return true; |
| 51 | if (a != null && b != null) { |
| 52 | int length = a.length(); |
| 53 | if (length == b.length()) { |
| 54 | if (a instanceof String && b instanceof String) { |
| 55 | return a.equals(b); |
| 56 | } else { |
| 57 | for (int i = 0; i < length; i++) { |
| 58 | if (a.charAt(i) != b.charAt(i)) return false; |
| 59 | } |
| 60 | return true; |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Copied from "android.util.Log.getStackTraceString()" in order to avoid usage of Android stack |
no outgoing calls