@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
38 lines • 1.6 kB
TypeScript
import { JavaClasses } from "./util/JavaTypes.js";
/**
* Utility methods related to Collections.
*
*/
export default class Collections {
/**
* @param values - Values to sort in-place. Must be of type \{Object[]|java.util.List\}
*
* @returns The sorted collection
*/
static sort<T>(values: T[]): T[];
static sort<T>(values: JavaClasses.List<T>): JavaClasses.List<T>;
/**
* https://stackoverflow.com/questions/29151435/javascript-place-elements-that-dont-match-filter-predicate-into-seperate-array
* Returns an array with two arrays at index 0 and 1. The array at index 0 is
* all the items in `arr` that passed the `predicate` truth test by returning
* a truthy value. The array at index 1 is all the items in `arr` that failed
* the `predicate` truth test by returning a falsy value.
*
* @param arr - The array to partition
* @param predicate - The predicate function to test each element
* @returns The partitioned array
*/
static partition<T>(arr: T[], predicate: (el: T, index: number, arr: T[]) => boolean): [T[], T[]];
/**
* Prints tabular data using 3 arrays,
* first for headers ie. ["HeaderA", "HeaderB", ...],
* second for the row data ie. [row1Obj, row2Obj, ...] where row1Obj.length == headers.length == spacing.length
* third for spacing ie. [10, 100, ...]
*
* @param headers -
* @param rowData -
* @param spacing -
*/
static printTable(headers: string[], rowData: string[][], spacing: number[]): void;
}
//# sourceMappingURL=Collections.d.ts.map