Sort tables with two elements

Posted by Mercer on Stack Overflow See other posts from Stack Overflow or by Mercer
Published on 2010-04-08T08:12:02Z Indexed on 2010/04/08 8:23 UTC
Read the original article Hit count: 327

Filed under:
|
|

Hello i want to make a sort in java. In my object i have many element so i want to make this sort with power and model

public class Product implements Comparable<Product>,Serializable
{   
private int idProduct ;
private int power;
private String model;
private String  color;
[...]
@Override
    public int compareTo(Product o) {
        return String.valueOf(this.power).compareTo(String.valueOf(o.power));

    }

so how to make sort with power and model

© Stack Overflow or respective owner

Related posts about java

Related posts about sort