Optional

A type-safe implementation of the Optional pattern

In One Line

Null? not Null? Never Matter!

Overview

A type-safe implementation of the Optional pattern, providing elegant null handling and functional programming features for both reference and value types.

The system provides two main structures:

  • Option<T> for reference types

  • ValueOption<T> for value types

Please read java official document about Optional.


Package Info

display name

AceLand Optional

package name

latest version

1.0.0

namespace

dependencies


How It Works

Key Features

  • Type-safe null handling

  • Functional programming support (Map, Where, Reduce)

  • Seamless conversion between reference and value types

  • Fluent interface for method chaining

  • Extension methods for convenient usage

  • Full equality comparison support

The system helps eliminate null reference exceptions while providing a clean, functional approach to handling optional values in Unity development.


Create

  • Option<T> where T : class

  • ValueOption<T> where T : struct

Get Value

  • same usage to Option<T> and ValueOption<T>


Last updated