小编Fol*_*oJr的帖子

Arrays.sort与Lambda然后比较

我是Java的新手,我正在尝试使用Lambda表达式和Comparators.我有这个公共类Person与其他getter和toString方法:

public class Person { 
    private String name;
    private int age;
    private int computers;
    private double salary;

public Person(String name, int age, int computers, double salary){
    this.name = name;
    this.age = age;
    this.computers = computers;
    this.salary = salary;
    }

public String getName(){
    return this.name;
}

public int getAge(){
    return this.age;
}

public int getComputers(){
    return this.computers;
}

public double getSalary(){
    return this.salary;
}
@Override
public String toString(){
    return "Name: " + getName() + ", age: "+ getAge() +
            ", N° …
Run Code Online (Sandbox Code Playgroud)

java sorting lambda comparator

1
推荐指数
1
解决办法
822
查看次数

标签 统计

comparator ×1

java ×1

lambda ×1

sorting ×1