【发布时间】:2019-09-13 18:53:23
【问题描述】:
如何 打印列表的内容和子列表。?有人可以帮我完成服务类逻辑吗? 问题如下为网络游戏创建一个程序,如下所示。 主列表 - 类别 类别子列表 - 课程
Categories Sample Data: (Add first 3 categories from the netplay app)
"id": 1001,
"name": "Computing",
"description": "network of remote servers"here
Course Sample Data:(Add first 3 courses on every category added from the netplay app)
id : 2001,
Category id: 1001,
name : "AWS"
duration : 180
miles :100
这是服务类如何实现这里的逻辑以将列表的内容与子列表一起返回
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import org.springframework.stereotype.Service;
@Service
public class ContentService {
private List<Category> categories=new ArrayList<>(Arrays.asList(new Category(1001, "Computing", "network of remote servers"));
//put your code here.
public List<Category> getAllContent() {
return categories;
}
}
【问题讨论】:
标签: java spring spring-boot spring-mvc