zoukankan      html  css  js  c++  java
  • 去除重复记录

    String[] arrstr = new String[] { "1", "2", "3", "2", "3", "4", "5", "6", "1", "7", "8", "2", "3", "4", };
    /// <summary>
       
    /// 移除数组中重复的项
       
    /// </summary>
       
    /// <param name="arr"></param>
       
    /// <returns></returns>
        private Hashtable RemoveSame(String[] arr)
        {
            Hashtable ht
    = new Hashtable();
           
    for (int i = 0; i < arr.Length; i++)
            {
               
    if (ht[arr[i].ToString()] == null)
                {
                    ht[arr[i].ToString()]
    = arr[i];
                }
            }
           
    return ht;
        }
     
     
    /// <summary>
       
    /// 移除数组中重复的项
       
    /// </summary>
       
    /// <param name="arr"></param>
       
    /// <returns></returns>
        private ArrayList RemoveSame(String[] arr)
        {
            Hashtable ht
    = new Hashtable();
      ArrayList al=new ArrayList ();
           
    for (int i = 0; i < arr.Length; i++)
            {
               
    if (ht[arr[i].ToString()] == null)
                {
                    ht[arr[i].ToString()]
    = arr[i];
        al.add(arr[i]);
                }
            }
           
    return al;
        }

    RemoveSame(arrstr);
  • 相关阅读:
    原型和原型链
    面向对象
    git在idea中的使用,如何构远程git方仓库
    java maven 安装
    Kafka消费者APi
    Kafka生产者APi
    kafka基本概念
    redis常用命令
    redis.conf配置文件参数说明
    Redis.RedisNativeClient的方法get_Db 没有实现
  • 原文地址:https://www.cnblogs.com/xsmhero/p/1621108.html
Copyright © 2011-2022 走看看