1:实体类
public class Book {
private Integer id;
private String name;
private String author;
private String year;
private Double price;
public Book() {
super();
}
public Book(Integer id, String name, String author, String year,
Double price) {
super();
this.id = id;
this.name = name;
this.author = author;
this.year = year;
this.price = price;
}
}
2:准备类数据
public class CreatData {
public static List<Book> getData(){
List<Book> list=new ArrayList<Book>();
for (int i = 1; i < 4; i++) {
Book book =new Book(i, "猪"+i+"戒", "老"+i+"佳", "163"+i, 36.5+i);
list.add(book);
}
return list;
}