2005-3-1学习笔记(Cloneable,List)

List list = new Vector();
    AnnuityStruct annuityStruct = null;
   
 for(int i = 0; i < recordCount.length; i++)
 {intCount = CCStrTools.str2Int(recordCount[i]);
  annuityStruct = PayoutObjectPool.getInstance().getAnnuityInstance();
  annuityStruct.init();
  annuityStruct.setAnnuitySeq(annuitySeq[intCount]);
  annuityStruct.setAnnuityPerson(Double.parseDouble(annuityPerson[intCount]));
  annuityStruct.setAnnuityAppPerson(Double.parseDouble(annuityAppPerson[intCount]));
  annuityStruct.setAnnuityCom(Double.parseDouble(annuityCom[intCount]));
  annuityStruct.setAnnuityAppCom(Double.parseDouble(annuityAppCom[intCount]));
  list.add(annuityStruct.clone());
 }




/**
  *PayoutObjectPool构造器
  */
 private PayoutObjectPool() {
  System.out.println("PayoutObjectPool create.");
 }

 /**
  *获取PayoutObjectPool实例
  *@return PayoutObjectPool 对象实例
  */
 public static synchronized PayoutObjectPool getInstance() {
  if (pool == null)
   pool = new PayoutObjectPool();
  return pool;
 }


/**
  *获取AnnuityStruct实例
  *@return AnnuityStruct 对象实例
  */
 public AnnuityStruct getAnnuityInstance() {
  if (annuityStruct == null)
   annuityStruct = new AnnuityStruct();
  return (AnnuityStruct) annuityStruct.clone();
 }



List里面放的都是引用~

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/faintbear/article/details/306726
文章标签: list null vector
个人分类: 学习笔记
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭