Returns a subsequence, up to the given maximum length, containing the final elements of the sequence.
SDK
- Xcode 10.2+
Framework
- Swift Standard Library
Declaration
Parameters
maxLength
The maximum number of elements to return. The value of
max
must be greater than or equal to zero.Length
Discussion
The sequence must be finite. If the maximum length exceeds the number of elements in the sequence, the result contains all the elements in the sequence.
Complexity: O(n), where n is the length of the sequence.