IMplementing custom comparator
<p>I am trying to implement a custom comparator for Beacon class (AltBeacon) framework. </p>

<pre><code>      Collections.sort(Arrays.asList(beacons), new Comparator&lt;Beacon&gt;(){
       @Override
       public int compare(Beacon lhs, Beacon rhs) {
           double diff =  lhs.getDistance() - rhs.getDistance();

           if (diff &gt; 0 ){
               return 1;
           }

           if (diff &lt; 0 ){
               return -1;
           }


           return 0;
       }
   });
</code></pre>

<p>It fails with a following error:</p>

<p><code>Error:(176, 19) error: no suitable method found for sort(List&lt;Collection&lt;Beacon&gt;&gt;,&lt;anonymous Comparator&lt;Beacon&gt;&gt;) method Collections.&lt;T#1&gt;sort(List&lt;T#1&gt;) is not applicable (cannot infer type-variable(s) T#1 (actual and formal argument lists differ in length)) method Collections.&lt;T#2&gt;sort(List&lt;T#2&gt;,Comparator&lt;? super T#2&gt;) is not applicable (inferred type does not conform to upper bound(s) inferred: Collection&lt;Beacon&gt; upper bound(s): Beacon,Object) where T#1,T#2 are type-variables: T#1 extends Comparable&lt;? super T#1&gt; declared in method &lt;T#1&gt;sort(List&lt;T#1&gt;) T#2 extends Object declared in method &lt;T#2&gt;sort(List&lt;T#2&gt;,Comparator&lt;? super T#2&gt;)</code></p>