Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
NameService.java
Upload User: shen332233
Upload Date: 2021-09-03
Package Size: 7478k
Code Size: 1k
Category:
Ajax
Development Platform:
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;
- }
- }