Closed danieldietrich closed 9 years ago
Just name it To
™
To.list(java.util.List)
To.option(java.util.Optional)
To.f(java.util.function.Function)
Traversable (implemented by many Javaslang classes, not only collections) has toJavaXxx()
methods. These convert Javaslang objects to Java objects.
This does not scale well. Instead we could provide a to(Class)
or to(Supplier<Collection>)
function. S.th. similar was suggested in jOOQ/jOOL#95.
TraversableOnce has toXxx()
methods to convert between Javaslang types.
Javaslang types have static of(...)
, ofAll(...)
factory methods to convert from the Java std lib world to Javaslang.
There shouldn't be a separate To
class. The toXxx
, toJavaXxx
methods should belong to a common interface. Currently TraversableOnce fits best.
This is obsolete. We now have Value
which is implemented by most of the Javaslang types and Value
has many conversion methods.
like so: