vendredi 24 février 2017

What is the design pattern used here?

When applying a comparator to a list in the following manner, what is the design pattern being used or what is the technique being used here?

Collections.sort(myCollection, new Comparator<MyItem>() {

    @Override
    public int compare(MyItem item1, MyItem item2) {
        return item1.getId().compareTo(item2.getId());
    }

});

Aucun commentaire:

Enregistrer un commentaire