📄 businessobject.java
字号:
package com.lovo.addressbook;import java.util.List;public class BusinessObject { int currentPos; User[] users; PropertiesUtil proutil; private String fileName = "config/telephone.dat"; public BusinessObject(){ currentPos = 0; proutil = new PropertiesUtil(fileName); users = getAllUsers(); } public User[] getAllUsers() { List <User> list = proutil.getUsers(); User[] users2 = new User[list.size()]; for(int i =0;i<list.size();i++){ users2[i]=list.get(i); } return users2; } public User first() { currentPos =0; return users[currentPos]; } public User previous() { if(currentPos >0){ currentPos --; } return users[currentPos]; } public User next() { if(currentPos < users.length - 1){ currentPos ++; } return users[currentPos]; } public User last() { currentPos = users.length - 1; return users[currentPos]; } public void saveUser(User user) { proutil.save(user); users = getAllUsers(); currentPos = Integer.parseInt(user.getNo()) - 1; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -