Releases: digipost/digg
0.36 - Enhanced forceOnAll exception handling
What's Changed
- forceOnAll will catch exception from resolving Stream element by @runeflobakk in #39
Full Changelog: 0.35...0.36
InputStreamIterator
0.34 NonEmptyList copy-constructors accepts Collection
What's Changed
- Upgrade guava, fix tests by @draperunner in #32
- actions: bump checkout, fix set-output by @hanskhe in #33
- Fix build by @runeflobakk in #35
- NonEmptyList copy-constructors accept Collection by @runeflobakk in #36
New Contributors
Full Changelog: 0.33...0.34
0.33: Merge pull request #30 from digipost/countdown-targetstate
A TargetState is used to determine is a certain state has been reached yet, commonly by querying TargetState.yet()
:
final TargetState cancelled;
...
if (!cancelled.yet()) {
// do work
}
A CountDown is an internally managed TargetState
which by itself reaches its target state of "count down reached zero" after an exact amount of queries to CountDown.yet()
.
The typical use-case for this is testing.
DiggExceptions.asUnchecked(..) enhancements
DiggExceptions.asUnchecked(..) enhancements #26
Some very minor enhancements to the utility for "translating" any exception into an unchecked one (which may always be thrown).
BisectSearch utility
BisectSearch utility: #25
Adds a util for performing bisection search (or binary searches) on ordered sets of arbitrary objects. The objects can be generated as needed based on an ordered index (where it "would" appear in an ordered set of the objects), and as such does not need to be existing instances in memory in order to be searched.
Non-empty lists and streams
The JDK provides Collections and Stream for expressing a multitude of zero to arbitrary many elements, while many actual domains deals with one to many elements. While using the general case of e.g. a List
to model this works all fine, it would be even better to have a generic data structure, with first-class support from the type system, to eliminate the illegal state of zero elements as early as possible, and in many cases also to offer some operations which are guarantied to be safe having one or more elements.
The 0.26 release adds two concepts: the NonEmptyList<T>
and NonEmptyStream<T>
. The stream implementation is independent of the list, but the NonEmptyList
knows how to transform into a NonEmptyStream
through its regular .stream()
method, overridden to return the more specific NonEmptyStream
type.
A Collector concept is also introduced for a more sensible transition from a non-empty stream back to a non-empty container, e.g. a non-empty list, by including an interface for the specific "result" type parameter of the Collector being an Optional. This allows to explicitly "flag" a collector of result-type Optional to produce its result based on if the source stream is empty or not, and the NonEmptyStream can detect on a type level when such collector is used, and bypass the redundant Optional and instead yield the result directly.
Please refer to the updated readme for more details and code examples.
Compatibility
This release breaks backwards binary compatibility because it changes the return types of a few static methods in DiggCollectors
. Source compatibility is however not affected by these changes. In practice, this means that if you depend on this new v0.26 release while also depending on another library which depends on an earlier version of Digg, things may break at runtime. However, the admittedly limited prevalence of Digg makes this highly unlikely, and has been considered to warrant yet another minor pre-1.0 release.
Java 11 support
- Removed
SimpleXmlAdapter.java
and can now build on java 11
ControllableClock enhancements
New
This release brings some enhancements to ControllableClock:
- an API for adjusting the clock for specific operations, and having it automatically reset afterwards
- methods for freezing the clock at a specific time (instead of having to first freeze it, then set the time)
Compatibility notes
This release breaks backwards compatibility for ControllableClock.
If you are upgrading and
- are referring to
TimeControllable
, change toClockAdjuster
- set clocks on ControllableClock, change invocations looking like
controllableClock.set(newClock)
tocontrollableClock.set(previous -> newClock)