|
|
|
@ -24,7 +24,6 @@ class ArrayList {
|
|
|
|
|
|
|
|
|
|
/* 新增和删除 */
|
|
|
|
|
public set(key: number, val: string | null) {
|
|
|
|
|
this.isOutOfRange(key);
|
|
|
|
|
if (val !== null) {
|
|
|
|
|
this.elements[key] = new Entry(key, val);
|
|
|
|
|
}
|
|
|
|
@ -65,12 +64,6 @@ class ArrayList {
|
|
|
|
|
}
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private isOutOfRange(key: number) {
|
|
|
|
|
if (key > this.elements.length - 1) {
|
|
|
|
|
throw new Error('Out of array range');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 基于数组简易实现的哈希表 */
|
|
|
|
|