![]() It allows you to create a list, set, and a map of values in just one line, just like you can do in Kotlin, Scala, or Groovy: process API enchantment, Stream API enhancements, and some useful methods on Optional class, but the API change which I liked most is the factory methods for Collection. ![]() JDK has added static factory methods like of() on to basic Collection interfaces which you can use to create a list of items.Įven though the Project Jigsaw or Java Module systems is the main highlight of the Java 9 release, there are several other useful features that are more helpful from a development point of view e.g. ![]() Unfortunately, Java doesn't support that yet but things have been improved with the factory methods for collection in JDK 9 and it's almost like that. to create a list of 1, 2, 3 you can simply write val items = listOf(1, 2, 3). If you have worked in Groovy or Kotlin then you know that how easy is to create the list with elements using collection literals e.g. The JEP stands for the JDK enhancement proposal. Hello guys, this is my first article in Java 9 features on this blog, and today you'll learn about my favorite feature "factory methods for collection", which is introduced as part of JEP 269.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |