Package Struct
Class Single<A>
java.lang.Object
Struct.Single<A>
- Type Parameters:
A
- the type of the object that this class holds.
A
Single
is designed to hold an object of a generic type A
.
This class provides a simple way to wrap a single object in a container, allowing for
operations on the object like setting, getting, and string representation with custom formatting.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Sahasrad Chippa
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
a
The value stored in thisSingle
container.
-
-
Constructor Details
-
Single
public Single()Constructs an emptySingle
instance withnull
as the value. -
Single
Constructs aSingle
instance that wraps the provided object.- Parameters:
a
- the object to wrap in thisSingle
instance
-
-
Method Details
-
toString
-
toString
Returns a string representation of the wrapped object, using custom specified prefix and suffix.- Parameters:
prefix
- the string to use before the object'stoString
resultsuffix
- the string to use after the object'stoString
result- Returns:
- a string consisting of the prefix, the object's
toString
result, and the suffix
-