-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MinimalistCollectionHolder.ts
42 lines (37 loc) · 1.89 KB
/
MinimalistCollectionHolder.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*******************************************************************************
Copyright (c) 2023-2024. Jonathan Bédard ~ JóôòKiwi
This project is free to use.
All the right is reserved to the author of this project.
******************************************************************************/
/**
* A minimalistic declaration of the {@link CollectionHolder}
*
* @param T The type (by default <em>unknown</em>)
*/
export interface MinimalistCollectionHolder<out T = unknown, > {
/**
* Get the size of the current {@link MinimalistCollectionHolder collection}
*
* @see ReadonlyArray.length
* @see ReadonlySet.size
* @see ReadonlyMap.size
* @see https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/size.html Kotlin Collection.size()
* @see https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/size.html Kotlin Map.size()
* @see https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Collection.html#size() Java Collection.size()
* @see https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/Map.html#size() Java Map.size()
* @see https://learn.microsoft.com/dotnet/api/system.linq.enumerable.count C# Count()
*/
get size(): number
/**
* Get the element at the specified index in the {@link MinimalistCollectionHolder collection}
*
* @param index The index to retrieve a value
* @throws CollectionHolderIndexOutOfBoundsException The index calculated is under zero
* or over the {@link size} (after calculation)
* @see ReadonlyArray.at
* @see https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/get.html Kotlin get(index)
* @see https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/List.html#get(int) Java get(index)
* @canReceiveNegativeValue
*/
get(index: number,): T
}