Comparison of Pojo class properties
<p>I have a class containing two properties:</p>

<pre><code>public class player{

public player(String playerName,int points){

    this.playerName=playerName;
    this.points=points;

}
    public String getPlayerName() {
        return playerName;
    }
    public void setPlayerName(String playerName) {
        this.playerName = playerName;
    }
    public int getPoints() {
        return points;
    }
    public void setPoints(int points) {
        this.points = points;
    }
    private String playerName;
    private int points;

}
</code></pre>

<p>I have arrayList class contains collection of palyer objects.</p>

<pre><code>List palyers=new ArrayList();
players.add(new player("mike",2));
players.add(new player("steve",3));
players.add(new player("jhon",7));
players.add(new player("harry",5);
</code></pre>

<p>Here my question is how to display player names with  smallest points difference.</p>

<p>Output:</p>

<pre><code>Based on the example code i written:

Mike and steve is the output

THis way comparison should happen:

mike to steve --&gt; 1

mike to jhon---&gt;5

mike to harry--&gt;3

steve to mike --&gt;1
steve to jhon---&gt;5
steve to harry---&gt;3

jhon to mike--&gt;5
jhon to steve--&gt;4
jhon to harry---&gt;2

harry to mike --&gt;3

harry to steve--&gt;2

harry to jhon --&gt;2

Based on above comparison mike and steve should display
</code></pre>

<p>Any java API to compare the properties?</p>
