国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

Robocode的線程與執(zhí)行次序

2019-11-18 12:21:24
字體:
供稿:網(wǎng)友

  Here are two methods that allow you to remove duplicates in an ArrayList. removeDuplicate does not maintain the order where as removeDuplicateWithOrder maintains the order with some performance overhead.
  1.The removeDuplicate Method:
  /** List order not maintained **/
  public static void removeDuplicate(ArrayList arlList)
  {
    HashSet h = new HashSet(arlList);
    arlList.clear();
    arlList.addAll(h);
  }
  
  2.The removeDuplicateWithOrder Method:
  /** List order maintained **/
  public static void removeDuplicateWithOrder(ArrayList arlList)
  {
    Set set = new HashSet();
    List newList = new ArrayList();
    for (Iterator iter = arlList.iterator(); iter.hasNext(); )
    {
     Object element = iter.next();
     if (set.add(element)) newList.add(element);
    }
    arlList.clear();
    arlList.addAll(newList);
  }

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 靖远县| 枞阳县| 若尔盖县| 岐山县| 玉田县| 黄浦区| 黄浦区| 阳泉市| 平原县| 青龙| 拜泉县| 寿阳县| 阳原县| 周宁县| 三门峡市| 申扎县| 长丰县| 轮台县| 渝北区| 陇南市| 东乌珠穆沁旗| 随州市| 新龙县| 石泉县| 阿图什市| 什邡市| 宜兰市| 昔阳县| 金坛市| 上高县| 阿拉善盟| 常州市| 太保市| 万宁市| 富顺县| 西昌市| 济南市| 壤塘县| 中方县| 沙雅县| 静乐县|