Java sort ArrayList with custom fields by number and alphabetically

前端 未结 5 1663
醉梦人生
醉梦人生 2020-12-19 05:24
public class Product implements Serializable{

    private String id;
    private String name;
    private double price ;
    private int quantity;

    public Produ         


        
5条回答
  •  感情败类
    2020-12-19 05:47

    As far as I know , you dont have such methods , what you can do is ; extend a subclass of Collection and add methods to sort (search or techniques like bubble sort,and more)

    If you have facility for a database (more overhead) *you could put it in there and use order by *if you are using JPA , just dump your list into a entity class

提交回复
热议问题