1/* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16package std.containers; 17 18/** 19 * List interface 20 */ 21export interface ListObject { 22 /** 23 * Pushes a value to the begin of the List 24 * 25 * @param e value to push 26 */ 27 pushFront(e: Object): void; 28 29 /** 30 * Pops a value from the begin of the List 31 * 32 * @returns popped value 33 */ 34 popFront(): Object; 35 36 /** 37 * Pushes a value to the end of the List 38 * 39 * @param e value to push 40 */ 41 pushBack(e: Object): void; 42 43 /** 44 * Pops a value from the end of the List 45 * 46 * @returns popped value 47 */ 48 popBack(): Object; 49 50 /** 51 * Returns number of elements in the List 52 * 53 * @returns number of elements in the List 54 */ 55 size(): int; 56 57 /** 58 * Returns an element at the specified index 59 * 60 * @param index element position 61 * 62 * @returns an element 63 */ 64 at(index: int): Object; 65 66 /** 67 * Sets an element at the specified index 68 * 69 * @param index element position 70 * 71 * @param e new value 72 */ 73 set(index: int, e: Object): void; 74 75 /** 76 * Checks if an element is in the List 77 * 78 * @param e value to find 79 * 80 * @returns true if value present, false otherwise 81 */ 82 has(e: Object): boolean; 83 84/* Code below is blocked by internal issue with lambdas #9994 85 forEach(fn: (e: Object): Object): ListObject; 86 map(fn: (e: Object): ): ; 87 fold(combine: (lhs: Object, rhs: Object): Object): Object; 88 foldWith(combine: (lhs: Object, rhs: Object): , initVal: ): ; 89 filter(filterCond: (e: Object): boolean): ListObject; 90 sort(comparator: (lhs: Object, rhs: Object): boolean): ListObject; 91*/ 92} 93