CodeGym
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Custom Collector and Spliterator

    JAVA 25 SELF
    Level 33, Lesson 4
    This lecture explains how to write custom collectors for the Stream API with Collector and when it is truly justified, as well as how to implement your own Spliterator for efficient sequential and parallel data traversal. We will step through the collector components ( supplier, accumulator, combiner, finisher, characteristics), examples for multi-maps and top-N, trySplit strategies, and the correct setup of characteristics ( ORDERED, SIZED, SUBSIZED, etc.).
    Available
  • List.of, Set.of, Map.of — immutable collections

    JAVA 25 SELF
    Level 34, Lesson 0
    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.
    Available
  • Map.copyOf, Set.copyOf, and other utilities

    JAVA 25 SELF
    Level 34, Lesson 1
    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.
    Available
  • CopyOnWrite collections, unmodifiable wrappers

    JAVA 25 SELF
    Level 34, Lesson 2
    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.
    Available
  • Mutable vs immutable collections: differences and use cases

    JAVA 25 SELF
    Level 34, Lesson 3
    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.
    Available
  • New collections: SequencedCollection, SequencedSet, SequencedMap

    JAVA 25 SELF
    Level 34, Lesson 4
    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.
    Available
  • Fundamentals of java.io and java.nio: differences, API evolution

    JAVA 25 SELF
    Level 35, Lesson 0
    This lecture is a brief guide to the evolution of file I/O in Java: from the “classic” java.io package with the File class, FileInputStream/ FileOutputStream streams, and character-based Reader/ Writer to modern java.nio.file (NIO.2) with Path, Files, and FileSystem. We’ll examine how the approaches differ, where asynchronous I/O shines, how to migrate safely ( File . toPath() ⇄ Path . toFile()), and also look at practical examples, a quick reference for choosing an API, and common mistakes.
    Available
  • File, Path, and Files classes: overview and object creation

    JAVA 25 SELF
    Level 35, Lesson 1
    In this lecture, we break down three key entities of Java’s file API: the historical File, the modern path abstraction Path from NIO.2, and the utility “Swiss Army knife” class Files. In practice, we’ll see how to create objects, convert File ↔ Path, safely join paths via resolve, obtain relative paths via relativize, normalize them with normalize, and perform operations such as Files.exists, Files.copy, Files.move, Files.readAllLines/ Files.write. The result is a clear understanding of when to use each approach and which mistakes are most common.
    Available
  • Reading and writing files: basic operations

    JAVA 25 SELF
    Level 35, Lesson 2
    In this lecture, we look at quick ways to work with files using the java.nio.file.Files utilities: read the entire file ( readAllBytes, readAllLines) and write data ( write) with an explicit charset StandardCharsets.UTF_8. We’ll discuss handling IOException, show practical examples, talk about when you need streaming APIs ( BufferedReader, BufferedWriter), and break down common mistakes.
    Available
  • File modes: reading, writing, appending

    JAVA 25 SELF
    Level 35, Lesson 3
    In this lecture, we examine file modes in Java: overwrite and append, combinations of StandardOpenOption options (for example, APPEND, CREATE, TRUNCATE_EXISTING, CREATE_NEW), working with text and bytes via Files.write()/ Files.readAllBytes(), when to choose streams ( BufferedReader/ BufferedWriter), and how to properly handle exceptions ( IOException, etc.). Plenty of practical examples and a breakdown of common mistakes.
    Available
  • Working with directories: create, delete, and list contents

    JAVA 25 SELF
    Level 35, Lesson 4
    A practical lecture on working with the file system via java.nio.file: create directories with Files.createDirectory and Files.createDirectories, delete via Files.delete and Files.deleteIfExists, list contents with Files.list, and cover recursive deletion with Files.walkFileTree. Step-by-step examples, a mini file manager, and a section on common mistakes will help you work confidently with folders on any OS.
    Available
  • BufferedReader, BufferedWriter: buffering, advantages

    JAVA 25 SELF
    Level 36, Lesson 0
    Why reading and writing files “with a teaspoon” is expensive: we’ll break down how buffering speeds up text I/O in Java. We’ll see how BufferedReader and BufferedWriter work on top of FileReader/ FileWriter, use line-by-line reading via readLine(), writing and newline via write()/ newLine(), explicit flushing with flush(), set the buffer size, and deal with encodings via InputStreamReader/ OutputStreamWriter. When to apply buffering, when not — and which mistakes happen most often.
    Available
  • 1
  • ...
  • 15
  • 16
  • 17
  • 18
  • 19
  • ...
  • 30
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym