optional

package
v0.0.0-...-1e7f4ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Optional

type Optional[T basic.Object] struct {
	// contains filtered or unexported fields
}

OptionalEmpty() Optional --- return an empty Optional instance OptionalOf(value) Optional --- return an Optional with the specified present non-null value Optional.ToString() string --- return a non-empty string representation of this optional suitable for debugging Optional.Get() interface{} --- If a value is present in this Optional, returns the value Optional.IsPresent() bool --- Whether there is a value in Optional Optional.Equal(obj interface{}) bool --- Indicates whether some other object is "equal to" this Optional

func Empty

func Empty[T basic.Object]() *Optional[T]

How does go implement static method - no static method, use function instead

func Map

func Map[T basic.Object, R basic.Object](op *Optional[T], f func(T) R) *Optional[R]

Could I use "[]" for custom type - maybe answer can be found in source code of map

func Of

func Of[T basic.Object](value T) *Optional[T]

func OfNullable

func OfNullable[T basic.Object](value T) *Optional[T]

func (*Optional[T]) Equals

func (op *Optional[T]) Equals(value T) bool

func (*Optional[T]) Get

func (op *Optional[T]) Get() T

func (*Optional[T]) IfPresent

func (op *Optional[T]) IfPresent(f func(T))

func (*Optional[T]) IsEmpty

func (op *Optional[T]) IsEmpty() bool

func (*Optional[T]) IsPresent

func (op *Optional[T]) IsPresent() bool

func (*Optional[T]) OrElse

func (op *Optional[T]) OrElse(other T) T

func (*Optional[T]) OrElseThrow

func (op *Optional[T]) OrElseThrow(msg string) T

func (*Optional[T]) String

func (op *Optional[T]) String() string

type OptionalInt

type OptionalInt struct {
	// contains filtered or unexported fields
}

OptionalEmpty() Optional --- return an empty Optional instance OptionalOf(value) Optional --- return an Optional with the specified present non-null value Optional.ToString() string --- return a non-empty string representation of this optional suitable for debugging Optional.Get() interface{} --- If a value is present in this Optional, returns the value Optional.IsPresent() bool --- Whether there is a value in Optional Optional.Equal(obj interface{}) bool --- Indicates whether some other object is "equal to" this Optional

func OptionalIntEmpty

func OptionalIntEmpty() *OptionalInt

How does go implement static method - no static method, use function instead

func OptionalIntof

func OptionalIntof(value int32) *OptionalInt

func (*OptionalInt) Equals

func (op *OptionalInt) Equals(value int32) bool

func (*OptionalInt) Get

func (op *OptionalInt) Get() int32

func (*OptionalInt) IsPresent

func (op *OptionalInt) IsPresent() bool

func (*OptionalInt) OrElse

func (op *OptionalInt) OrElse(other int32) int32

func (*OptionalInt) String

func (op *OptionalInt) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL