MCPcopy Create free account
hub / github.com/ReadyTalk/avian / compareTo

Method compareTo

classpath/java/lang/String.java:193–209  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

191 }
192
193 @Override
194 public int compareTo(String s) {
195 if (this == s) return 0;
196
197 int idx = 0;
198 int result;
199
200 int end = (length < s.length ? length : s.length);
201
202 while (idx < end) {
203 if ((result = charAt(idx) - s.charAt(idx)) != 0) {
204 return result;
205 }
206 idx++;
207 }
208 return length - s.length;
209 }
210
211 public int compareToIgnoreCase(String s) {
212 if (this == s) return 0;

Callers 1

equalsMethod · 0.95

Calls 2

charAtMethod · 0.95
charAtMethod · 0.65

Tested by

no test coverage detected