Android代码模版整理<一>

 1 package com.ieslab.app.socket;
 2 
 3 import java.io.IOException;
 4 
 5 /**
 6  * <p>
 7  * 
 8  * 名称:类
 9  * 
10  * 功能:描述
11  * 
12  * 日期:2013-12 modify by 蔺
13  * 
14  * <p>
15  */
16 
17 //单例模式  
18 public class XclSingleton  
19 {  
20     //单例模式实例  
21     private static XclSingleton instance = null;  
22       
23     //synchronized 用于线程安全,防止多线程同时创建实例  
24     public synchronized static XclSingleton getInstance(){  
25         if(instance == null){  
26             instance = new XclSingleton();  
27         }     
28         return instance;  
29     }     
30       
31     private static final HashMap<String, Object> mMap;  
32     
33     //构造函数
34     private XclSingleton()  
35     {  
36         mMap = new HashMap<String,Object>();  
37     }  
38       
39     public void put(String key, Object value){  
40         mMap.put(key, value);  
41     }  
42       
43     public Object get(String key)  
44     {  
45         return mMap.get(key);  
46     }  
47       
48     /**
49      *<p>
50      * 方法
51      *<p>
52      *
53      * @param data
54      *
55      * @return true if success ,false otherwise
56      *
57      */
58     
59 }  

 

posted @ 2013-12-31 09:31  Shuaiwen8023  阅读(336)  评论(0编辑  收藏  举报