💻 Sitemap - Java
-
What is a variable • Variable Declaration Syntax • Variable Naming Rules • Examples of Valid Names • Basic Data Types (Briefly) • Code — Examples of Types • Declaration vs Initialization • Dynamic Initialization • Scope and Lifetime • Example: Nested Scopes • Initialization Inside a Block • Restriction: you cannot declare the same names in nested scopes • Constants • Recommendations • Homework • Test — How well did you understand the lesson?
-
1. Basic truth: Stream vs For — this is not an equal battle • 2. Why for is faster • 3. Why Stream is Slower • 4. Boxing — the main killer of performance • 5. When Stream is NOT worse • 6. When Stream is severely losing • 7. JIT and why the results "float" • 8. CPU cache and call order • 9. Practical Rule for Selection • Use for if: • Use Stream if: • 10. Final Conclusion • ⚔️ Stream vs For in Java — maximum detailed comparative table • ⚡ Stream vs Loop - Code Example with Comments
-
1️⃣ HashMap / TreeMap / TreeSet (not thread-safe) • 2️⃣ SynchronizedMap / SynchronizedSortedMap / SynchronizedSortedSet • 3️⃣ ConcurrentHashMap • 4️⃣ ConcurrentSkipListMap / ConcurrentSkipListSet • 5️⃣ AtomicInteger / AtomicReference / AtomicLong • Tables for Comparison: One Element, Two Threads • Table: one element is edited by two threads + new key is added • Comparison of Thread-Safe Sorted Collections • 🔹 Conclusions • 🔹 Practical Rule
-
Preface • Comparison of Approaches to Parallelism in Java • 1️⃣ Fork/Join Framework • Key elements: • Example: • 2️⃣ CompletableFuture — asynchronous programming with functional style • Main features: • Example of a CompletableFuture chain: • 3️⃣ Virtual Threads (Project Loom) • Advantages: • Example of Virtual Threads: • 4️⃣ How to Choose the Right Tool • Transition from Threads to Modern Tools • On what basis CompletableFuture makes decisions • Virtual Threads (Project Loom) — The Future of Multithreading in Java • In Brief • Example: Regular Threads vs Virtual Threads • Key Advantages • When to Use • Limitations and Pitfalls • Practical Migration • Summary • Virtual Streams Loom as a Metaverse • Comparison of Approaches to Parallelism in Java and Prerequisites for Choosing • Conclusion
-
What the loop consists of • Loop for • Decrementing the counter • Step of changing the counter • Loop while • Loop do...while • Operators break and continue • break — interrupting the loop • continue — jump to the next iteration • Summarizing • Homework • Test — How well did you understand the lesson?
-
1) Simple if / else • 2) else if — chain of checks • 3) Comparison Operators and Negation • 4) Logical operators: && (AND) and || (OR) • 5) Ternary Operator — Compact, but Cautious • 6) switch — when there are many discrete options • 7) A small cheat sheet for debugging • Test — How well did you understand the lesson?
-
Diagram - Java Memory Model - Heap / Non-Heap / Stack • Java Memory Deep Dive: how objects, primitives and methods live in memory • Java Memory Example: Explanation • Java Caching and GC: how SoftReference affects the life of objects in memory • Java SoftReference Cache Example: Explanation • JIT Compiler with JVM, JIT and Code Cache
-
2. Virtual Threads — millions of lightweight threads • ✅ Advantages of Virtual Threads • ❌ Disadvantages of Virtual Threads • 3. GraalVM — universal accelerator • ✅ Advantages of GraalVM • ❌ Disadvantages of GraalVM • 4. Quarkus — Java for Clouds and AI • ✅ Advantages of Quarkus • ❌ Disadvantages of Quarkus • 5. Why this is not a replacement, but maturity • 6. General Direction
-
⚡ 1. Simple explanation • 🔥 2. Example: allocations • 3. Where hidden allocations appear • 1. Collections • 2. Streams • 3. String operations • 4. Exceptions • ⚙️ 4. Where Zero Allocation is Really Important • 🚀 5. How Zero Allocation is Achieved • 🧠 6. Important point about JVM • 💣 7. Where Zero Allocation Breaks • 📊 8. Comparison of Approaches • 🏁 Result
Useful Articles:
Data Types in Java Hello! This is Vitaly Lesnykh. In this lesson of the "Java Basics for Beginners" course, we will discuss what data types are. Data types are the foundation of any programming langu...
Signs of a legacy project: how to recognize an old ship A legacy is not just old code. It is a living organism that has survived dozens of changes, team shifts, outdated technologies, and numerous tem...
Understanding Multithreading in Java through Collections and Atomics 1️⃣ HashMap / TreeMap / TreeSet (not thread-safe) HashMap: Structure: array of buckets + linked lists / trees (for collisions). U...
New Articles:
Zero Allocation — is an approach to writing code in which no unnecessary objects are created in heap memory during runtime. The main idea: fewer objects → less GC → higher stability and performance. ...
In Java, performance is often determined not by the "beauty of the code," but by how it interacts with memory, the JIT compiler, and CPU cache. Let s analyze why the usual for is often faster than Str...
This article is dedicated to a general overview of how the compiler, build, and tooling practices are arranged in Go, and how to better understand them through comparison with Java. We will not delve ...