Posts

Showing posts from May, 2017

Kotlin and Java EE Part Three - Making it Idiomatic

Kotlin and Java EE Part Three - Making it IdiomaticConverting Java EE application to Kotlin started with the battle with the framework, where we successfully outmaneuvered all the obstacles presented by sometimes archaic standards. In the process, the code was enriched with modern, Kotlin-specific constructs making it concise and safer.
If you did not read the previous two parts of the series, you can find them here:Kotlin and Java EE: Part One - From Java to KotlinKotlin and Java EE: Part Two - Having Fun with PluginsAfter briefly revisiting already made changes, I will add some final touches.What We Already DidMany constructs from the previous two parts are already idiomatic Kotlin. Let’s take a look at set definition:privatefinal Set<Class<?>> classes =newHashSet<>(Arrays.asList(KittenRestService.class));As Java does not support a simple construction of Set and some other collections from a list of objects, we have to go to Arrays class to create List (!), and the…