JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • List.of, Set.of, Map.of — immutable collections

    JAVA 25 SELF
    34 level,0 lecture
    In this lecture we examine immutable collections in Java 9+: the factory methods List.of, Set.of, Map.of and Map.ofEntries. We will compare them with the wrappers Collections.unmodifiableList, discuss limitations (no mutations, no null, no duplicates for a set and for map keys), element order, and performance. We will look at the limit of 10 pairs for Map.of and typical exceptions: UnsupportedOperationException, NullPointerException, IllegalArgumentException. Plus practical examples of when such collections simplify design and improve read-side thread safety.
    Open
  • Map.copyOf, Set.copyOf, and other utilities

    JAVA 25 SELF
    34 level,1 lecture
    In this lecture we cover immutable copies of collections introduced in Java 10: List.copyOf, Set.copyOf and Map.copyOf. You will learn how they differ from the Collections.unmodifiable* wrappers, what constraints apply (no null, immutability), when the same object is returned, and why you must not rely on a specific implementation. Practical usage scenarios and typical mistakes are shown, including confusion with Map.of and Map.ofEntries.
    Open
  • CopyOnWrite collections, unmodifiable wrappers

    JAVA 25 SELF
    34 level,2 lecture
    In this lecture, we examine two approaches to “protecting” collections: unmodifiable wrappers from Collections.unmodifiable* and the factory methods List.of/ Set.of/ Map.of, as well as the thread-safe CopyOnWriteArrayList and CopyOnWriteArraySet from the java.util.concurrent package. We will understand how a wrapper differs from true immutability, where CopyOnWrite structures are useful, and what typical mistakes occur in practice.
    Open
  • Mutable vs immutable collections: differences and use cases

    JAVA 25 SELF
    34 level,3 lecture
    In this lecture, we break down the differences between mutable and immutable collections in Java: when to choose ArrayList/ HashSet and when to prefer Java 9+ factory methods ( List.of, Set.of, Map.of) and copies via copyOf. We will discuss safety, thread safety, ease of debugging, pitfalls of the Collections.unmodifiableList wrapper and practical usage examples, as well as common mistakes and how to avoid them.
    Open
  • New collections: SequencedCollection, SequencedSet, SequencedMap

    JAVA 25 SELF
    34 level,4 lecture
    In Java 21, ordered-collection interfaces appeared — SequencedCollection, SequencedSet, and SequencedMap. They add a unified contract for working with element order: fast access to the first/last element and reversing a collection via reversed(). In this lecture, we will examine which standard collections already implement them, what methods were added, how to apply this in real code, as well as common mistakes and usage nuances.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy