import {comparator, List} from "../Interface"; import {flombok} from "../flombok"; import {ArrayList} from "../utils/ArrayList"; /*** * @ArrayA Proxy class, allow to extend the prototype of the native Object. * Dont forget to implement your method in global interface ObjectConstructor, * Location of this interface is in Interfaces.ts */ export abstract class ArrayA extends Array implements comparator{ /*** * */ public asList( value : T[] ): List {return new ArrayList(value);} /*** * */ public newList( ... value : T[] ): List {return new ArrayList(value);} /*** * */ public list( ... value : T[] ): List {return this.newList.apply(this,arguments);} /*** * @test */ public sum( ): number{return /*Number(new ArrayList(this).stream().sum().orElse(-1))*/-1;}; /*** * */ @flombok.ENUMERABLEFUNC(false) public equals(o: Array): boolean { let current: Array = >this.valueOf(), i:number=0; for(; i < current.length; i++)if(!o[i].equals(current[i])) return false; return true; } } Object.package(this);