16 lines
288 B
TypeScript
16 lines
288 B
TypeScript
|
|
export class Tuple<T, U> {
|
||
|
|
constructor(public first: T, public second: U) {}
|
||
|
|
|
||
|
|
public get(): [T, U] {
|
||
|
|
return [this.first, this.second];
|
||
|
|
}
|
||
|
|
|
||
|
|
public switchGet(elem: any): any{
|
||
|
|
if(elem == this.first){
|
||
|
|
return this.second;
|
||
|
|
} else {
|
||
|
|
return this.first;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|