當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript linkedList.LinkedList類代碼示例

本文整理匯總了TypeScript中vs/base/common/linkedList.LinkedList的典型用法代碼示例。如果您正苦於以下問題:TypeScript LinkedList類的具體用法?TypeScript LinkedList怎麽用?TypeScript LinkedList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LinkedList類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('Push/Iter', function () {
		const list = new LinkedList<number>();
		list.push(0);
		list.push(1);
		list.push(2);
		assertElements(list, 0, 1, 2);
	});
開發者ID:AllureFer,項目名稱:vscode,代碼行數:7,代碼來源:linkedList.test.ts

示例2: test

	test('Insert/Iter', function () {
		const list = new LinkedList<number>();
		list.insert(0);
		list.insert(1);
		list.insert(2);
		assertElements(list, 0, 1, 2);
	});
開發者ID:elibarzilay,項目名稱:vscode,代碼行數:7,代碼來源:linkedList.test.ts

示例3: test

	test('unshift/toArray', () => {
		let list = new LinkedList<string>();
		list.unshift('foo');
		list.unshift('bar');
		list.unshift('far');
		list.unshift('boo');
		assertElements(list, 'boo', 'far', 'bar', 'foo');
	});
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:8,代碼來源:linkedList.test.ts

示例4:

	function assertElements<E>(list: LinkedList<E>, ...elements: E[]) {
		// first: assert toArray
		assert.deepEqual(list.toArray(), elements);

		// second: assert iterator
		for (let iter = list.iterator(), element = iter.next(); !element.done; element = iter.next()) {
			assert.equal(elements.shift(), element.value);
		}
		assert.equal(elements.length, 0);
	}
開發者ID:AllureFer,項目名稱:vscode,代碼行數:10,代碼來源:linkedList.test.ts

示例5: add

	public add(callback: Function, context: any = null, bucket?: IDisposable[]): () => void {
		if (!this._callbacks) {
			this._callbacks = new LinkedList<[Function, any]>();
		}
		const remove = this._callbacks.push([callback, context]);
		if (Array.isArray(bucket)) {
			bucket.push({ dispose: remove });
		}
		return remove;
	}
開發者ID:SeanKilleen,項目名稱:vscode,代碼行數:10,代碼來源:callbackList.ts

示例6: entries

	public entries(): [Function, any][] {
		if (!this._callbacks) {
			return [];
		}
		return this._callbacks
			? this._callbacks.toArray()
			: [];
	}
開發者ID:SeanKilleen,項目名稱:vscode,代碼行數:8,代碼來源:callbackList.ts

示例7: invoke

	public invoke(...args: any[]): any[] {
		if (!this._callbacks) {
			return undefined;
		}

		const ret: any[] = [];
		const elements = this._callbacks.toArray();

		for (const [callback, context] of elements) {
			try {
				ret.push(callback.apply(context, args));
			} catch (e) {
				onUnexpectedError(e);
			}
		}
		return ret;
	}
開發者ID:SeanKilleen,項目名稱:vscode,代碼行數:17,代碼來源:callbackList.ts


注:本文中的vs/base/common/linkedList.LinkedList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。