Record Class Try.Partition<V>
java.lang.Object
java.lang.Record
dmx.fun.Try.Partition<V>
- Type Parameters:
V- the value type of theSuccesselements- Record Components:
successes- an unmodifiable list of values fromSuccesselements, in encounter orderfailures- an unmodifiable list of causes fromFailureelements, in encounter order
A typed container holding the two partitions produced by
Try.partitioningBy().
The successes list uses Collections.unmodifiableList(List) over a new
ArrayList (not List.copyOf(Collection)) so that null values
produced by Try.run(...) are preserved. The same
strategy applies in Try.sequence(Iterable), Try.traverse(Iterable, java.util.function.Function),
and Try.toList(). The rationale is documented in
ADR-009 — unmodifiableList instead of List.copyOf in Try.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.failures()Returns the value of thefailuresrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thesuccessesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Partition
Defensively copies both lists and null-checks them. UsesCollections.unmodifiableList(List)over a newArrayListrather thanList.copyOf(Collection)so thatnullsuccess values produced byTry.run(...)are preserved.
-
-
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). -
successes
-
failures
-