mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
20 lines
632 B
HTML
20 lines
632 B
HTML
<html>
|
|
<body>
|
|
Reports method references mapped to the <code>Comparator</code> interface that don't fulfill its contract.
|
|
<p>
|
|
Some method references, like <code>Integer::max</code>, can be mapped to the <code>Comparator</code> interface.
|
|
However, using them as <code>Comparator</code> is meaningless and the result might be unpredictable.
|
|
</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
ArrayList<Integer> ints = foo();
|
|
ints.sort(Math::min);
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
ArrayList<Integer> ints = foo();
|
|
ints.sort(Comparator.reverseOrder());
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |