zoukankan      html  css  js  c++  java
  • 列表

    List
    
    function List(){
         this.dataStore = 0;
        this.insert = insert;
        this.find = find;
        this.append = append;
        this.remove = remove;
    
    //插入 function insert(element, after) { var insertPos = this.find(after); if (insertPos > -1) { this.dataStore.splice(insertPos + 1, 0, element); ++this.listSize; return true; } return false; } //查找 function find(element) { for (var i = 0; i < this.dataStore.length; ++i) { if (this.dataStore[i] == element) { return i; } } return -1; } //数据末尾插入 function append(element) { this.dataStore[this.listSize++] = element; }
    //删除 function remove(element) { var foundAt = this.find(element); if (foundAt > -1) { this.dataStore.splice(foundAt, 1); --this.listSize; return true; } return false; }
    }

      

    from:https://blog.csdn.net/haoshidai/article/details/52263191

  • 相关阅读:
    java面向对象(五)之多态
    java集合(list,set,map)
    jQuery基础
    Numpy详解
    Pandas详解一
    Linux 解压缩
    Linux 磁盘挂载
    Linux 磁盘管理
    su和sudo命令详解
    Linux查看文件命令
  • 原文地址:https://www.cnblogs.com/Longhua-0/p/9573132.html
Copyright © 2011-2022 走看看