Record Class Option.Some<Value>
java.lang.Object
java.lang.Record
codes.domix.fun.Option.Some<Value>
- Type Parameters:
Value- the type of the non-null value encapsulated by this instance- Record Components:
value- the non-null value encapsulated by this instance
- All Implemented Interfaces:
Option<Value>
Represents a container object that holds a non-null value.
The Some class is a concrete implementation of the Option
interface, used to encapsulate a value that is guaranteed to be non-null.
Attempting to create an instance of Some with a null value
will throw a NullPointerException.
-
Nested Class Summary
Nested classes/interfaces inherited from interface codes.domix.fun.Option
Option.None<Value>, Option.Some<Value> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Some
Constructs a newSomeinstance with the specified non-null value.- Parameters:
value- the non-null value to be encapsulated by thisSomeinstance- Throws:
NullPointerException- if the provided value isnull
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
-