employeesearchservice.java

来自「使用struts的Tiles插件功能 使用拉Tiles框架 进行struts」· Java 代码 · 共 34 行

JAVA
34
字号
package com.jamesholmes.minihr;

import java.util.ArrayList;

public class EmployeeSearchService{
	private static Employee[] employees={
		new Employee("Bob Davidson","123-45-6789"),
		new Employee("Mary Milliams","343-23-2342"),
		new Employee("Beverly Harris","233-34-2343"),
		new Employee("Jim Smith","111-11-1111"),
		new Employee("Jim Davidson","444-44-4444")
	};
	
	public ArrayList searchByName(String name){
		ArrayList resultList=new ArrayList();
		for(int i=0;i<employees.length;i++){
			if(employees[i].getName().toUpperCase().indexOf(name.toUpperCase())!= -1){
				resultList.add(employees[i]);
			}
		}
		return resultList;
	}
	
	public ArrayList searchBySsNum(String ssNum){
		ArrayList resultList=new ArrayList();
		
		for(int i=0;i<employees.length;i++){
			if(employees[i].getSsNum().equals(ssNum)){
				resultList.add(employees[i]);
			}
		}
		return resultList;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?