posts - 6, comments - 1, trackbacks - 0, articles - 0

          NameManager的實現(xiàn)

          Posted on 2008-09-23 11:44 jr4e 閱讀(134) 評論(0)  編輯  收藏 所屬分類: Eclipse
          public class NameManager implements INameManager {
                 private Set namePool = new HashSet();
                

              public String generateName(String nameType) {

                  if (!namePool.contains(nameType)) {
                 namePool.add(nameType);
                  return nameType;
            }

            int i = 1;
            while (namePool.contains(nameType + i)) {
             i++;
            }
            namePool.add(nameType + i);
            return nameType + i;
           }


          主站蜘蛛池模板: 安平县| 涞源县| 淅川县| 确山县| 郓城县| 晋中市| 兴宁市| 张家港市| 湾仔区| 启东市| 中江县| 孟连| 新沂市| 庆元县| 白山市| 长岛县| 泰安市| 四会市| 长垣县| 濮阳市| 东海县| 峨边| 武邑县| 甘泉县| 太保市| 弥勒县| 开平市| 许昌县| 台中县| 乐业县| 杭州市| 金塔县| 武汉市| 伊通| 大渡口区| 虹口区| 云林县| 伊春市| 万山特区| 定兴县| 怀集县|