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
  • map[K]V: creation, read/write, delete, len, nil-map

    Go SELF
    15 level,0 lecture
    In this lecture you will study the map data structure in Go: how the map[K]V type is structured, how it differs from slices, how to create maps via make and a literal, how to read and write values via m[k] and m[k] = v, how to delete elements with delete, get the size via len, and also what you can and cannot do with a nil-map and how to safely initialize a map before writing to it.
    Open
  • v, ok := m[k] — telling “no key” apart from zero value

    Go SELF
    15 level,1 lecture
    In this lecture, you will break down the “ok idiom” for reading from a map in Go: why the expression m [ k ] can return a seemingly valid value while still hiding the fact that the key is missing, what zero value is, how to read v , ok := m [ k ], and how to avoid common traps using examples with task statuses, discounts, and strings.
    Open
  • Iterating over map: why the order is not guaranteed

    Go SELF
    15 level,2 lecture
    In this lecture, we break down how iterating over a map via for range works in Go, why the output order of elements is not part of the contract, where the “randomness” of the order comes from, what guarantees range does provide, and how to avoid typical mistakes (unstable tests, using the “first element” as business logic, and incorrect expectations when changing the v variable).
    Open
  • Stable output: sorting keys and slices

    Go SELF
    15 level,3 lecture
    In this lecture, we’ll break down how to produce deterministic (stable) output in Go: why iterating a map with range does not guarantee order, how to get predictable output via “keys → sort → print”, how to sort simple keys with the sort package ( sort.Strings, sort.Ints), how to define your own ordering with sort.Slice, and how to use the modern slices package ( slices.Sort and slices.SortFunc). We’ll also discuss tie-breakers for equal elements and common mistakes that make output “jitter” and break automated tests.
    Open
  • Set via map[T]struct{} and counters

    Go SELF
    15 level,4 lecture
    In this lecture we cover two very common patterns built on map in Go: a set via map [ T ] struct {} and frequency counters via map [ string ] int. We will talk about make, the zero value, the ok idiom ( v, ok := m[key]), safe delete, stable output by sorting keys, and typical mistakes with nil maps and map [ string ] bool.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush