体育彩票销售站联盟

* 先往文件保存10个花类(包括花编号,花名称,花龄)对象,再取出来  * 去掉花名重复的花对象,再按照花龄升序排列

有你方安好2019-01-11 02:32:28

package firstExam.second;

import java.util.ArrayList;
import java.util.List;

/**
 * 先往文件保存10个花类(包括花编号,花名称,花龄)对象,再取出来
 * 去掉花名重复的花对象,再按照花龄升序排列
 */
public class Test {

 public static void main(String[] args) {
  List<Flower> flowers=new ArrayList<Flower>();
  String[]name={"rose1","rose2","rose1","rose2","grass1",
    "grass2","flower1","flower2","flower1","flower2"};
  int[] age={1,3,6,2,6,3,2,4,2,4};
  for(int i=0;i<name.length;i++){
   Flower flower=new Flower();
   flower.setId(i+1);
   flower.setName(name[i]);
   flower.setAge(age[i]);
   
   flowers.add(flower);
  }
  FlowerService flowerService=new FlowerService();
  flowerService.saveFlower(flowers);
  flowerService.getFlower(flowers);
  flowerService.distinct();
  
 }
 


}