Test11.java 819 Bytes
package com.yohoufo.order;

import com.google.common.collect.Lists;
import com.yohoufo.product.model.PriceTrendResp;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by li.ma on 2019/1/17.
 */
public class Test11 {
    public static void main(String[] args) {
        List<PriceTrendResp> result = Lists.newArrayList();

        PriceTrendResp resp =new PriceTrendResp();
        resp.setEndTime("2019-01-09 00:00:00");
        resp.setProductId(1002512);
        result.add(resp);

        PriceTrendResp resp1 =new PriceTrendResp();
        resp1.setEndTime("2019-01-09 00:00:00");
        resp1.setProductId(46346346);
        result.add(resp1);

        List<PriceTrendResp> collect = result.stream().distinct().collect(Collectors.toList());

        System.out.println(collect);
    }
}