AppleWeightSortDemo

package com.ant.jdk8.com.ant.jdk8.chap01;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

public class AppleWeightSortDemo {
    public static void main(String[] args) {
        List<Apple> apples = Arrays.asList(new Apple("green",2),
                new Apple("green",1),new Apple("red",3));
        apples.sort(Comparator.comparing(Apple::getWeight));
        apples.stream().forEach(apple-> System.out.println(apple.getWeight()));
    }
}

AppleWeightSortDemo

AppleWeightSortDemo

上一篇:e552. 取Applet的参数


下一篇:oracle 权限管理