CodeGym
Promotion
CodeGym University
Java FullStack
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
  • Set: HashSet and TreeSet, element uniqueness

    JAVA 25 SELF
    Level 26, Lesson 3
    In this lecture, we break down the Set interface in Java: how it differs from List, how element uniqueness is enforced, how the implementations HashSet (fast, no order) and TreeSet (sorted) work, and when to choose which structure. We will cover important nuances about equals() and hashCode(), working with null, examples of common tasks (removing duplicates, checking uniqueness), and frequent mistakes.
    Available
  • Generics: why they are needed, basic syntax

    JAVA 25 SELF
    Level 26, Lesson 4
    We move from “raw” collections to type-safe code. In this lecture we explain why, before generics, collections based on Object led to runtime errors ( ClassCastException), how generics catch these at compile time, how to read and write constructs like List<String>, Map<String, Integer>, what the “diamond operator” <> is, and why type erasure is needed. Plus examples with your own generic classes and a breakdown of common mistakes.
    Available
  • Interfaces Collection, List, Set, Map: hierarchy

    JAVA 25 SELF
    Level 27, Lesson 0
    We break down the foundations of Java collections: the Collection interface and its branches List, Set, Queue/ Deque, as well as the separate Map hierarchy. You’ll learn why Map does not extend Collection, what the hierarchy looks like, how implementations differ, which methods are key, and when to choose what. In the end—common mistakes and how to avoid them.
    Available
  • Iterable and Iterator: iterating collections

    JAVA 25 SELF
    Level 27, Lesson 1
    In this lecture we explain how to work with the Iterable and Iterator interfaces: what the iterator() method does, how the for-each loop works “behind the scenes,” when and why to use hasNext() and next() manually, how to safely remove elements via remove() without ConcurrentModificationException, and how to iterate a Map properly using keySet(), values(), and entrySet(). Plenty of practical examples and common mistakes to reinforce the material.
    Available
  • Queue, Deque, Stack: working with queues and stacks

    JAVA 25 SELF
    Level 27, Lesson 2
    In this lecture, we explore queues and stacks in Java: how the FIFO and LIFO principles work, how Queue, Deque, and Stack differ, why modern projects choose ArrayDeque, and how to safely use the methods offer/ poll/ peek and push/ pop/ peek. We’ll show examples with LinkedList, PriorityQueue, a mini print app and an undo stack, and also cover common mistakes.
    Available
  • NavigableSet/NavigableMap

    JAVA 25 SELF
    Level 27, Lesson 3
    In this lecture we cover ordered and navigable Java collections: NavigableSet and NavigableMap. In practice, we’ll see how to work with ranges via subSet/ headSet/ tailSet, find “nearest” elements using lower, floor, ceiling, higher, and manage the ends via pollFirst/ pollLast. We’ll examine reverse views descendingSet/ descendingMap, “live” views, and typical use cases (schedules, priorities, scales). As implementations we’ll use TreeSet and TreeMap.
    Available
  • Generics wildcards

    JAVA 25 SELF
    Level 27, Lesson 4
    In this lecture, we cover the invariance of generics in Java, type parameter bounds ( extends/ super), wildcard types ?, and the PECS rule (“Producer Extends, Consumer Super”). We will look at how to write universal methods with wildcards, how type erasure works, the limitations when using instanceof and arrays, as well as practice with collections and the Stream API. At the end—common mistakes and how to avoid them.
    Available
  • Filtering collection elements

    JAVA 25 SELF
    Level 28, Lesson 0
    In this lecture, we explore practical collection filtering in Java: an imperative approach using a for loop, safe removal during iteration with an Iterator and its remove() method, as well as the modern and concise removeIf (Java 8+). We will discuss why ConcurrentModificationException occurs, when it makes sense to create a new list, and the typical mistakes most often made when formulating filtering conditions.
    Available
  • Collection transformation

    JAVA 25 SELF
    Level 28, Lesson 1
    In this lecture, we examine how to perform collection transformation imperatively: turning List<String> into List<Integer> (for example, string lengths), how to extract fields from domain model objects ( Product → name/price), how to “flatten” nested collections via addAll() or nested loops, and how to combine filtering with transformation using if and methods like startsWith. We will finish by reviewing common mistakes: mutating the source collection, incorrect casts ( ClassCastException), and performance considerations.
    Available
  • Safe removal of elements

    JAVA 25 SELF
    Level 28, Lesson 2
    In practice, removing elements from collections often leads to a ConcurrentModificationException. In this lecture we’ll break down why this happens when iterating with for-each, how to safely remove elements using Iterator.remove(), why ListIterator is useful, when to choose removeIf (Java 8+), and how to work correctly with a Map. At the end — practical tips and common pitfalls.
    Available
  • EnumSet/EnumMap

    JAVA 25 SELF
    Level 28, Lesson 3
    In this lecture we break down specialised collections for enums — EnumSet and EnumMap from java.util: how they work under the hood (bitmasks and indexing by ordinal), why they are faster and more compact than HashSet/ HashMap, where to apply them (flags, lookup tables, finite state machines), what pitfalls come with changing an enum and with serialization, plus a set of best practices and common mistakes with clear code examples.
    Available
  • LinkedHashSet/LinkedHashMap

    JAVA 25 SELF
    Level 28, Lesson 4
    In this lecture we cover order‑preserving collections: LinkedHashSet and LinkedHashMap. You will learn how they maintain insertion order and access order, how to build an LRU cache in a few lines by overriding removeEldestEntry, what the memory and performance overheads are compared to HashSet/ HashMap, when a deterministic order is needed for stable tests and reports, and why ArrayDeque is better than LinkedList for queues/stacks. At the end — common pitfalls and how to avoid them.
    Available
  • 1
  • ...
  • 12
  • 13
  • 14
  • 15
  • 16
  • ...
  • 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