Basic high-level data structure library for Node.js, inspired by Java
$ npm i lucky.js --save
- LinkedList 链表
- HashMap 哈希
- RedBlackTree 红黑树
- MinimumHeap 最小堆
- AVLTree
- BTree B+树
See the detailed API Reference.
'use strict';
const {LinkedList, HashMap} = require('lucky.js');
const linkedList = new LinkedList();
const hashMap = new HashMap();
// LinkedList
linkedList.add('one');
linkedList.add('two');
const topValue = linkedList.peek(); // one
// HashMap
hashmap.put('one', 1);
const value = hashmap.get('one'); // 1
const oldValue = hashmap.replace('one', 1); // null
Lucky.js © Ricky 泽阳, Released under the MIT License.