MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / compare

Method compare

Hackerank/Java/bigdecimal.java:17–25  ·  view source on GitHub ↗
(String o1, String o2)

Source from the content-addressed store, hash-verified

15 sc.close();
16Arrays.sort(s, new Comparator<String>() {
17 @Override
18 public int compare(String o1, String o2) {
19 if (o1 == null || o2 == null) {
20 return 0;
21 }
22 BigDecimal o1bd = new BigDecimal(o1);//creating objects for bigdecimal
23 BigDecimal o2bd = new BigDecimal(o2);
24 return o2bd.compareTo(o1bd);
25 }
26 });
27 //Printing the output
28 for(int i=0;i<n;i++)

Callers

nothing calls this directly

Calls 1

compareToMethod · 0.45

Tested by

no test coverage detected