JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q40560F
  • License ISC

arraylist collection

Package Exports

  • arraylists

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (arraylists) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ArrayList API:

下载
npm install arraylists

引用包

    let ArrayList = require("arraylists");

创建一个ArrayList对象

    let list = new ArrayList();

添加一个元素

    list.add(item);

添加多个元素

    list.add(item1,item2,item3...);

删除指定元素

    list.remove(item);

清空集合元素

    list.clear();

深克隆一个集合

    let list2 = list.clone();

检查集合中是否包含指定元素

    let bool = list.contains(item);

获取指定位置上的元素

    let temp = list.get(index);

返回此列表中首次出现的指定元素的索引,或如果此列表不包含元素,则返回 -1

    let index = list.indexOf(item);

判断集合是否为空

    let bool = list.isEmpty();

用指定的元素替代此列表中指定位置上的元素

    list.set(index,item);

遍历集合

    list.forEach(e => {
        let key = e.key;
        let value = e.value;
    });

获取元素中第一个元素

    list.first();

获取元素中最后一个元素

    list.last();

关于作者:
email:admin@w3c.top