⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nameservice.java

📁 《ajax基础教程》源码
💻 JAVA
字号:
/* * NameService.java * * Created on June 20, 2005, 8:17 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package ajaxbook.chap4;import java.util.ArrayList;import java.util.Iterator;import java.util.List;/** * * @author nate */public class NameService {    private List names;        /** Creates a new instance of NameService */    private NameService(List list_of_names) {        this.names = list_of_names;    }        public static NameService getInstance(List list_of_names) {        return new NameService(list_of_names);    }        public List findNames(String prefix) {        String prefix_upper = prefix.toUpperCase();        List matches = new ArrayList();        Iterator iter = names.iterator();        while(iter.hasNext()) {            String name = (String) iter.next();            String name_upper_case = name.toUpperCase();            if(name_upper_case.startsWith(prefix_upper)){                        boolean result = matches.add(name);            }        }        return matches;    }    }

⌨️ 快捷键说明

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