mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-08 21:52:48 +07:00
1. Better documentation 2. Flip arguments in case of strict inequality 3. Better tests (cherry picked from commit 56c1dab39962fb457ca38a6ac44125b38ef11ea3) IJ-CR-192581 GitOrigin-RevId: d9c31f14f62a2d6ea28aa00cf67985d9b2ccfb44
21 lines
602 B
HTML
21 lines
602 B
HTML
<html>
|
|
<body>
|
|
Reports <code>if</code> statements and ternary expressions with <code>Comparator.compare()</code> calls
|
|
that can be replaced with <code>Comparator.max()</code> or <code>Comparator.min()</code> calls.
|
|
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
Comparator<String> comp = Comparator.naturalOrder();
|
|
String result = comp.compare(a, b) > 0 ? a : b;
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
Comparator<String> comp = Comparator.naturalOrder();
|
|
String result = comp.max(a, b);
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
|
|
<p><small>New in 2026.1</small></p>
|
|
</body>
|
|
</html>
|