Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/careercup/ctci
/ compare
Method
compare
java/Chapter 18/Question18_7/LengthComparator.java:6–10 ·
view source on GitHub ↗
(String o1, String o2)
Source
from the content-addressed store, hash-verified
4
5
public
class
LengthComparator implements Comparator<String> {
6
public
int
compare(String o1, String o2) {
7
if
(o1.length() < o2.length())
return
1;
8
if
(o1.length() > o2.length())
return
-1;
9
return
0;
10
}
11
}
Callers
nothing calls this directly
Calls
1
length
Method · 0.45
Tested by
no test coverage detected