Skip to content

Commit

Permalink
Update documentation for list/first.
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin McDermott <[email protected]>
  • Loading branch information
bigkevmcd committed Nov 23, 2024
1 parent 8128e0b commit 568b432
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,36 @@ Examples:
].sortBy(e, e.score).map(e, e.name)
== ["bar", "foo", "baz"]

### Last

**Introduced in the OptionalTypes library version 2**

Returns an optional with the last value from the list or `optional.None` if the
list is empty.

<list(T)>.list() -> <Optional(T)>

Examples:

[1, 2, 3].list().value() == 3
[].last().orValue('test') == 'test'

This is syntactic sugar for list[list.size()-1].

### First

**Introduced in the OptionalTypes library version 2**

Returns an optional with the first value from the list or `optional.None` if the
list is empty.

<list(T)>.first() -> <Optional(T)>

Examples:

[1, 2, 3].first().value() == 1
[].first().orValue('test') == 'test'

## Sets

Sets provides set relationship tests.
Expand Down

0 comments on commit 568b432

Please sign in to comment.