Define a custom POJO, like this:
package com.example.models; public class ManufacturerPrice { private String name; private String description; // ... ommit setters & getters }
Define a Comparator variable, like this:
Comparator<ManufacturerPrice> priceComparator = (a, b) -> a.getName().compareTo(b.getName());
Use
Collections.sort
with your custom Comparator, like this:// entities is a Collection of ManufacturerPrice, such as List, Set, etc. Collections.sort(entities, priceComparator);