- Creating ListsBuild a NonEmptyList from constructors, collection expressions, factories and existing sequences, and know which calls throw and which return null.
- Safe MutationAdd, remove and reorder elements without ever emptying the list, through the class or any interface, and add your own invariants in a derived type.
- Reading ElementsRead the head, last element and tail without emptiness checks, and use indexers, ranges, list patterns, deconstruction, searching and conversions.
- Type-Preserving LINQWhich LINQ operators keep the NonEmptyList<T> type, which fall back to IEnumerable<T>, and how query syntax, ordering and grouping work.
- Functional OperationsMap, reduce, fold, scan, zip, split, take, rotate and validate a NonEmptyList, with the non-empty guarantee carried through every result that can keep it.
- Generic MathSum, Product, Average, Median, Mode, Max, Min and MinMax on a non-empty list: no empty-sequence exception, no seed value, and support for your own numeric types.
- Async OperationsMap, filter, fold and iterate a non-empty list with async delegates, sequentially or in parallel, and convert to and from IAsyncEnumerable.
Version: Next
Working with Lists
Create, change, read, query and aggregate a NonEmptyList<T> without an empty-sequence exception path.