RUVIDEO
Поделитесь видео 🙏

Java 9 | Factory Methods | Practical execution смотреть онлайн

📁 Лайфстайл 👁️ 18 📅 05.12.2023

This video describes about the enhancements on Java 9 Factory Methods - List, Set and Map interfaces.

The people who wants to see very less minutes , for them I will chop individual interfaces into different videos.

1. The arrival of Java 9 brings many new features to Java’s Collections API, one of which being collection factory methods. Java 9 has created factory methods for creating immutable Lists, Sets, Maps, and Map.Entry Objects
2. In older versions in Java, like Java 8 and earlier versions, we can use Collections class utility methods like unmodifiableXXX to create Immutable Collection objects for our requirements. If we want to create an Immutable List, then we can use Collections.unmodifiableList method. Same can be applied with Set and Map.
3. These methods are too long and more detailed. In order to achieve the same behavior, Java 9 has provided utility methods to List, Set and Map interfaces.


Advantages:
1. These lists are immutable. Elements cannot be added, removed, or replaced in these lists. Calling any mutator method (i.e. add, addAll, clear, remove, removeAll, replaceAll) will always cause UnsupportedOperationExceptionto be thrown.
2. They do not allow null elements. Attempts to add null elements result in NullPointerException.
3. They are serializable if all elements are serializable.
4. The order of elements in the list is the same as the order of the provided arguments, or of the elements in the provided array.

Set :

By using Java 8 Streams:

Set behave very similar to List with only few differences. e.g.
1. Set do not allow duplicate elements as well. Any duplicate element passed will result in IllegalArgumentException.
2. The iteration order of set elements is unspecified and is subject to change.

Map

Compare to List and Set this is more verbose.

Java 9 implementation provides :
Maps have also had factory methods added. They work a little differently as Maps have keys and values rather than a single type of element. For up to 10 entries Maps have overloaded constructors that take pairs of keys and values
Clearly, new factory methods to create immutable collections in java 9 are very much readable and easy to use.

-~-~~-~~~-~~-~-
Please watch: "What is JShell ? | Practical explanation of JShell | Java 9 feature JShell | JShell | REPL"
https://www.youtube.com/watch?v=T-e1EnKgWq0
-~-~~-~~~-~~-~-

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java 9 | Factory Methods | Practical execution» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.