This article explores Google Guava's core utilities for Java developers, demonstrating how Joiner, Splitter, and CharMatcher simplify string handling, how Immutable collections provide true immutability versus JDK's unmodifiable views, and how Multimap, BiMap, and Table solve common collection gaps. It also covers primitive utilities, functional transforms with Functions and Predicate, null-safety via Preconditions and Optional, a self-maintaining local Cache, and ListenableFuture for cleaner async callbacks.
This tutorial demonstrates Java Stream API for filtering and extracting collection data, covering stream creation from Lists, Sets, Maps, and arrays, key operations like filter, limit, skip, concat, distinct, and collecting results into List, Set, or Map with practical code examples.
The article analyzes the upcoming Go 1.28 collection proposal #80590, detailing how native Set, Map, Hash and ordered map types will replace manual map‑based sets, improve performance with constant‑time membership checks, enable custom hashers for non‑comparable keys, and simplify code for both developers and AI programming assistants.
The Go Collections working group’s umbrella proposal for Go 1.28 adds seven generic collection components—including hash‑based Set, ordered tree Map, and a revamped generic heap—addressing long‑standing gaps in the language’s standard library and outlining design trade‑offs and future extensions.
This comprehensive tutorial covers Java fundamentals including program structure, variables, data types, operators, control flow, arrays, methods, object-oriented programming, exception handling, generics, collections, and practical examples for beginners.
This article walks through ten core Java collection topics—including ArrayList vs LinkedList, HashMap internals across JDK 7 and 8, the put and resize processes, ConcurrentHashMap design, HashSet implementation, fail‑fast vs fail‑safe iterators, and the difference between Collection and Collections—providing the detailed analysis and code examples interviewers expect.
This article demystifies the Iterator design pattern by describing its purpose of separating collection storage from traversal, illustrating everyday analogies, presenting a complete Java implementation—including interfaces, concrete aggregate, custom iterator, and test code—and summarizing typical applications, advantages, and drawbacks.
FastUtil, an open‑source library maintained by Sebastiano Vigna, offers type‑specialized Java collections that are typically 2–5× faster and use 40–70% less memory than JDK equivalents, and this article provides detailed benchmarks, a cheat‑sheet of core types, production‑ready code snippets, Maven/Gradle setup, and a checklist of common pitfalls to help developers adopt FastUtil safely and efficiently.
The article reviews the seven Java 8 Map convenience APIs—getOrDefault, putIfAbsent, computeIfAbsent, computeIfPresent, compute, merge, and forEach—plus replaceAll and Map.of, showing concise code examples, best‑practice recommendations, concurrency considerations, and common pitfalls for modern Java developers.
The article explains Java's primitive types versus object types, introduces wrapper classes such as Integer, Double and Boolean, demonstrates manual and automatic boxing/unboxing, reveals the -128~127 Integer cache trap, shows common wrapper APIs, and warns about null‑unboxing NPEs.
This article presents fourteen practical Java collection techniques—ranging from creating immutable and empty collections to using computeIfAbsent, Map.merge, Collectors.groupingBy, and EnumMap/EnumSet—each illustrated with concise code snippets and explanations that improve readability, safety, and performance in Spring Boot applications.
The article explains why a HashMap lookup can return null even when key objects have identical fields, showing that the default equals and hashCode implementations compare memory addresses, and demonstrates how overriding both methods fixes the issue and avoids real‑world bugs.
The article explains three typical traps when working with Java List: Arrays.asList returns a fixed‑size list that throws UnsupportedOperationException on add/remove, iterating and removing elements directly also fails, and converting primitive arrays with Arrays.asList produces an unexpected single‑element list.
This article presents eight concrete rules for handling null values in Spring Boot 3 applications, illustrating common pitfalls with code snippets, explaining production‑impact risks, and offering best‑practice solutions such as using empty collections, explicit null checks, proper Optional usage, and consistent API design.
This article explains why raw collections are unsafe, how Java generics enforce compile‑time type safety, reduce casting, improve code readability, and boost performance, and it walks through generic interfaces, collections, custom generic classes, inheritance rules, diamond syntax, and common restrictions with concrete code examples and diagrams.
This article explains why Java generics were introduced, demonstrates how they improve type safety and reduce casting through concrete examples with generic classes, interfaces, collections, custom generic methods, and highlights common pitfalls such as generic arrays and static methods.
An in‑depth look at why Java’s TreeSet can trigger ConcurrentModificationException under high concurrency, exploring the red‑black tree’s non‑atomic operations, thread scheduling nuances, and how various concurrent set implementations—synchronized wrappers, read‑write locks, ConcurrentSkipListSet, CopyOnWriteArraySet, and custom designs—compare in performance and suitability.
This article explains the motivation behind Java generics, their benefits such as compile‑time type checking and reduced casting, and provides concrete examples including generic classes, interfaces, collections, inheritance, custom generic methods, and common pitfalls, illustrated with code snippets and diagrams.
This article explains the purpose and contract of Java's equals and hashCode methods, shows how the default implementations work, demonstrates why String overrides equals, outlines the three-step equality check, and provides guidelines for correctly overriding these methods in custom classes.
This article combines practical salary insights for Java developers at Transsion with a deep dive into Java fundamentals—including the compilation pipeline, JVM benefits, differences from C++, exception handling, core collection frameworks, concurrency concepts, interview preparation tips, and essential AI knowledge for developers.
Transsion’s Java positions in Shanghai and Shenzhen pay 300k‑400k RMB, the interview is surprisingly simple, and the article walks through Java’s compilation pipeline, JVM benefits, Java‑C++ differences, exception handling, collections, concurrency, multithreading, project‑prep tips, and essential AI concepts for interviewers.
This article explains the purpose and usage of Java generic symbols T, E, K, V, and ?, covering their history, type‑safety benefits, practical code examples, advanced constraints, and best‑practice guidelines for writing clear and flexible generic code.
The article explains why ConcurrentModificationException occurs when a Java collection is structurally modified during iteration, illustrates typical scenarios such as enhanced‑for loops and multithreaded access, and provides practical solutions including iterator.remove(), thread‑safe collections, synchronized blocks and iterating over copies.
This article compiles essential Spring and Java utility methods—including assertion checks, object and collection handling, file I/O, resource management, and reflection/AOP tools—providing concise code examples and usage guidelines to help developers avoid redundant code and write cleaner, more reliable applications.
This article examines Java HashMap traversal techniques, compares keySet, entrySet, iterator and stream approaches, explains why keySet appears to iterate twice by revealing its internal iterator implementation, and presents code examples and decompiled snippets to illustrate the underlying mechanisms.
This article explains the key differences between Java's Stream toList() method introduced in JDK 16, which returns an unmodifiable list, and the traditional collect(Collectors.toList()) which yields a mutable ArrayList, illustrating behavior with code examples, performance considerations, and practical usage tips.
This article explains why using Java's Arrays.asList() to convert an array into a List can cause UnsupportedOperationException at runtime, illustrates the hidden fixed‑size list implementation, shows the severe impact on an e‑commerce system, and provides a safe solution using java.util.ArrayList to avoid such crashes.
This article explains how Kotlin's standard library provides concise builder functions such as buildList, buildSet, buildMap, and buildString to create immutable collections and strings efficiently, reducing boilerplate and eliminating lambda overhead while offering specialized variants for primitive types.
This article introduces Java 8 functional programming concepts such as lambda expressions and method references, explains the Stream API, and provides dozens of practical code snippets for querying, grouping, aggregating, sorting, partitioning, and parallel processing of collections, helping developers handle most everyday business logic efficiently.
This article explains the internal mechanism of HashMap traversal in Java, detailing how keySet() leads to two iteration steps via an iterator, while entrySet() and Map.forEach() provide a single-pass iteration, and examines the underlying iterator classes and their constructors.
This article introduces nine indispensable Java utility classes—including Collections, CollectionUtils, Lists, Objects, StringUtils, BeanUtils, ReflectionUtils, DigestUtils, and HttpStatus—showing how each can simplify common tasks, reduce boilerplate code, and improve development efficiency with clear examples and code snippets.
This article explains why using Arrays.asList to convert an array into a List can produce an immutable, fixed‑size list that throws UnsupportedOperationException on add or remove operations, illustrates the issue with real‑world incident details, analyzes the internal implementation, and provides a safe replacement using java.util.ArrayList.
This article explains how Java's foreach loop is implemented using iterators, demonstrates the bytecode differences between array and collection traversal, analyzes why modifying a HashMap during foreach can trigger ConcurrentModificationException, and shows the correct way to safely modify collections with an iterator.
This article presents a comprehensive collection of Python fundamentals, covering useful string methods like partition and translate, mutable versus immutable types and argument passing, tuple unpacking, dictionary utilities, set operations, iterator implementations, best practices for exception handling, and various decorator techniques with practical code examples.
Java 8 enriches the Map interface with default methods such as getOrDefault, forEach, merge, putIfAbsent, compute, computeIfAbsent, computeIfPresent and replace, allowing developers to retrieve values with fallbacks, iterate entries, combine or conditionally update entries, and thus write more concise, readable code with far less boilerplate.
An in‑depth comparison of Java’s Hashtable and HashMap covers their thread‑safety mechanisms, null‑key/value policies, inheritance hierarchy, default capacities, resizing strategies, and iterator behavior, highlighting performance trade‑offs and best‑practice alternatives for concurrent applications.
This article explains how to apply Python type hints—including basic types, the modern pipe syntax for optional values, collection generics, union types, and the flexible Any type—through clear examples and best‑practice guidance to make code more readable and safer.
This article explains why modifying a List inside a foreach loop causes ConcurrentModificationException, shows the proper ways to remove elements using iterators or lambda expressions, warns against casting subList to ArrayList, clarifies correct toArray and Arrays.asList usage, compares LinkedList and ArrayList performance, and recommends the most efficient traversal techniques.
This article explores how mutating the fields of an object used as a HashMap key corrupts its hash code, causing look‑ups to fail, and walks through the underlying source code of put, hash, getNode and related methods to reveal why this happens.
This article explains how using Arrays.asList() to convert an array into a List creates a fixed‑size collection that throws UnsupportedOperationException on add or remove operations, illustrates the issue with a real e‑commerce incident, and shows how to safely wrap the result with a mutable java.util.ArrayList.
This article provides a concise overview of several Python standard‑library modules—including collections, heapq, bisect, array, weakref, and pprint—explaining their main features, typical use‑cases, and offering clear code examples for each.
This article examines core and advanced data structures in PHP and Laravel, demonstrating how arrays, associative and multidimensional arrays, collections, and JSON storage can be leveraged with practical code examples and query‑optimization techniques to build efficient, scalable, and maintainable web applications.
This article compares two Java lists using removeAll and a Map‑based approach, shows performance tests that reveal removeAll becomes prohibitively slow for large collections, explains the underlying algorithmic cost, and demonstrates how counting with a Map dramatically improves speed.
This guide explains why standard Java collections are not thread‑safe, introduces their concurrent counterparts such as Vector, ConcurrentHashMap, and various BlockingQueue implementations, and provides concrete code examples and usage patterns for safe multi‑threaded programming.
This article presents a collection of practical Python techniques—including one‑line variable swapping, list, set and dictionary comprehensions, the Counter class for counting, pretty‑printing JSON, inline conditional expressions, list slicing, itertools combinations, and a quirky False‑equals‑True example—each illustrated with concise code snippets and explanations.
This article introduces Java Stream API introduced in JDK 8, explains its pipeline concept, and demonstrates practical operations such as traversal, filtering, deduplication, type conversion, collection‑to‑map transformations, pagination, matching, and parallel processing with clear code examples.
The article compares using Optional.ofNullable with map() versus a traditional null‑check ternary operator for retrieving a Hyperlink's link property, evaluates their readability, performance, and suitability, and extends the discussion to native versus utility‑based collection‑empty checks in Java.
This article explains how to efficiently perform null checks in Java by selecting appropriate utility classes such as StringUtils, ObjectUtils, Collections, and CollectionUtils for different data types, and also includes a brief notice about a free programmer book giveaway.
This article introduces the JDK 8 Map API enhancements—including getOrDefault, forEach, merge, putIfAbsent, compute, computeIfAbsent, computeIfPresent, and replace—explaining their usage with clear examples and showing how they simplify common map‑handling patterns in Java.
This article explains Java enums introduced in Java 5, shows how to define simple and complex enum types, demonstrates their use in comparisons, switch statements, collections like EnumSet and EnumMap, and illustrates applying enums to design patterns such as Singleton and Strategy, while providing practical code examples and JSON serialization techniques.
This article introduces ten advanced Python topics—including exception handling, the collections and itertools modules, lambda functions, decorators, generators, threading, dunder methods, logging, and context managers—providing explanations, code examples, and practical tips to help developers deepen their programming skills and prepare for interviews.
This article demonstrates how replacing a costly nested‑loop search for matching user IDs with a pre‑built HashMap dramatically reduces processing time from tens of seconds to a few seconds, explaining the underlying time‑complexity benefits and providing complete Java code examples.
This article introduces Java's Map interface, explains the expanded API added since Java 8, and provides practical code examples for methods such as getOrDefault, forEach, replaceAll, computeIfAbsent, merge, and the immutable factories introduced in Java 9, helping developers deepen their collection framework knowledge.
This article introduces the Java 8 Map API enhancements—including getOrDefault, forEach, merge, putIfAbsent, compute, computeIfAbsent, computeIfPresent, and replace—explaining their purpose, showing concise code examples, and demonstrating how they simplify common map‑handling scenarios.
This article introduces Java 8 Stream API, demonstrates filtering, mapping, sorting, collecting, and parallel streams with POJO examples, including code snippets, performance tips, and links to related resources, while also containing promotional messages for ChatGPT services.
This article explains Guava's Multimap feature, covering its core one‑to‑many mapping capabilities, common methods, various implementations (ArrayListMultimap, HashMultimap, LinkedHashMultimap, TreeMultimap, immutable and synchronized versions), and provides concrete Java code examples and a social‑network scenario to help developers choose the right implementation.
This article introduces Java 8's Stream API, explains how to create streams from collections and arrays, and demonstrates a wide range of intermediate and terminal operations with clear code examples to help developers write concise, efficient, and readable Java code.
This guide introduces Google’s Guava library for Java, covering Maven integration, data validation with Preconditions, immutable collections, factory methods, counting collections, multimap usage, advanced string joining and splitting, and simple caching, showing how each feature can make code cleaner, safer, and more efficient.
This article provides a comprehensive guide to Python fundamentals, covering CSV file reading and writing, powerful iterator utilities from itertools, advanced collection types like Counter, defaultdict and OrderedDict, techniques for error and warning output, code debugging, style checking, profiling, and practical performance‑optimisation principles.
This article provides a comprehensive guide to Google Guava, covering its core modules such as collections, concurrency, string utilities, I/O, caching, event bus, functional programming, reflection, and best‑practice code examples that demonstrate how to simplify and strengthen Java development.
This article introduces Java 8's Stream API, explains its declarative pipeline model for filtering, mapping, sorting, and collecting data, demonstrates each operation with a UserPo example, and provides complete runnable code including parallel streams and statistical summaries.
This article explains Java's EnumMap, covering its definition, key characteristics, how to create and use it with code examples, its efficient array‑based implementation, and practical test cases, demonstrating why EnumMap is a high‑performance map for enum keys in backend development.
This article introduces Java 8's Stream API, explains its functional style for handling collections, demonstrates common operations such as filter, map, sorted, forEach, collect, statistics, and parallelStream with concrete POJO examples, and provides a complete runnable code sample.
This article introduces Python's collections, heapq, bisect, and array standard‑library modules, explaining their purpose and providing clear code examples for namedtuple, deque, heap operations, binary search, and efficient array handling in everyday programming.
This article introduces Java 8 Stream API, explains its functional style similar to SQL, and demonstrates how to process PO objects using filter, map, sorted, forEach, collect, statistics, and parallelStream operations with complete code examples.
The article explains why modifying a HashMap—by removing, adding, or putting entries—while iterating with a Java foreach loop causes a ConcurrentModificationException, demonstrates the underlying bytecode transformation, and shows how to safely perform such operations using an Iterator.
The article explains how sorting a List while iterating over it in Java can cause a ConcurrentModificationException, describes the fast‑fail mechanism of iterators, shows the root cause in nested method calls, and provides a safe fix using a copied list.
This article introduces Java 8 Stream API, explaining its declarative approach to processing collections, and demonstrates common operations such as filter, map, sorted, forEach, collect, statistics, and parallelStream with a PO class example, while also including full source code and brief promotional notes.
This article introduces several useful classes from Python's collections module—including Counter, defaultdict, deque, namedtuple, ChainMap, UserList/UserDict/UserString, as well as heapq and an OrderedDict‑based LRU cache—explaining their purposes and providing ready‑to‑run code examples for each.
The article explains why fail‑fast iterators throw ConcurrentModificationException when a collection is modified during iteration, outlines two common scenarios that trigger the exception, and presents both incorrect and correct Java code examples along with strategies such as avoiding modifications, using synchronization, iterator.remove(), or switching to fail‑safe concurrent collections.
This article introduces eight ready‑to‑use Java Stream APIs—including Stream.ofNullable, Stream.iterate, collectingAndThen, dropWhile/takeWhile, IntStream, teeing, concat, and partitioningBy—showing how each can cleanly handle nulls, generate sequences, transform collections, and combine streams with concise code examples.
This article explains how Java's Arrays.asList creates a fixed‑size list that throws UnsupportedOperationException on add/remove, and how ArrayList.subList returns a mutable view whose non‑structural changes affect both the original list and the sublist while structural changes can trigger ConcurrentModificationException, providing code examples and practical guidelines.
This article provides a comprehensive guide to Rust's HashMap, covering its core concepts, creation, insertion, updating, value access, iteration, removal, and advanced entry strategies with clear code examples to help developers use this powerful collection efficiently.
Java's Arrays.asList method has three major pitfalls: it cannot directly convert primitive arrays like int[] because of autoboxing limits, it returns a fixed-size list that throws UnsupportedOperationException on modification, and the list shares its backing array so changes to the original array are reflected in the list; using Arrays.stream for boxing or wrapping the result in a new ArrayList avoids these issues.
This tutorial covers a range of advanced Python topics—including exception handling, the collections module, itertools utilities, lambda functions, decorators, generators, threading, dunder methods, logging, and context managers—to help developers deepen their programming expertise and apply these techniques in real projects.
This article introduces several lesser‑known but highly practical Python standard‑library modules—including collections, datetime, random, itertools, csv, os, pickle, argparse, and unittest—explaining their core classes and functions with clear code examples and common application scenarios.
This article provides a comprehensive overview of the Java Collections Framework, explains frequent mistakes such as modifying collections during iteration or using toMap with null values, and introduces practical utility libraries like Hutool, Apache Commons Collections, and Guava to help developers write safer and more efficient code.
This article introduces Java 8 Stream API, explains how to create streams from collections, demonstrates common intermediate operations such as filter, map, flatMap, limit, skip, distinct, sorted, peek, and shows terminal actions like forEach, count, max, min, findFirst, findAny, and match methods with practical code examples.
This comprehensive guide explains Java's collection framework, covering the core interfaces Collection, List, Set, and Map, their abstract and concrete implementations, iterator mechanisms, and key differences that are essential for both interview preparation and real‑world backend development.
This article compares Java's List.of() and Arrays.asList() methods, detailing their immutable versus mutable characteristics, handling of nulls, size constraints, and underlying array behavior, and provides practical code examples and guidance on choosing the appropriate method for different programming scenarios.
This article explains how Java lambda expressions and the Stream API can replace verbose loops, comparators, and aggregation code with concise, readable functional constructs, covering traversal, sorting, aggregation, optional handling, thread creation, mapping, grouping, and parallel processing of collections.
This article provides an in-depth tutorial on Java 8 Stream API, covering its concepts, creation methods, intermediate and terminal operations, mapping, reduction, collection, grouping, sorting, and includes numerous practical code examples to help developers master functional programming with streams.
Java Stream API enables functional-style, declarative processing of collections and other data sources, offering lazy evaluation, parallel execution, and a rich set of intermediate and terminal operations such as filter, map, sorted, reduce, and collect, with examples illustrating creation, transformation, and practical usage.
JDK 21 introduces Sequenced Collections with new interfaces and unified methods, allowing developers to retrieve the first and last elements of List, Deque, and Set collections using a single, consistent API instead of disparate, cumbersome calls.
This article demonstrates six different techniques for eliminating duplicate elements from a Java List, including HashSet, TreeSet, LinkedHashSet, iterator-based removal, Stream distinct, and manual contains checks, each with complete code examples and output illustrations.
This article walks through the latest Java 21 additions—including enhanced String search methods, new Emoji utilities in Character, repeat() for StringBuilder and StringBuffer, updated Charset factories, named regex groups, SequencedCollection interfaces, localized DateTimeFormatter patterns, extended Math and BigInteger operations, and improved Thread and Future APIs—providing code examples and usage guidance.
This article explains the concepts, creation methods, and extensive usage patterns of Java 8 Stream API—including filtering, mapping, reducing, collecting, sorting, and combining—through detailed code examples that demonstrate how to process collections efficiently with lambda expressions.
This article provides an in‑depth tutorial on Java 8 Stream API, explaining its concepts, intermediate and terminal operations, and demonstrating over twenty practical code examples—including filtering, mapping, reducing, collecting, grouping, and parallel streams—to help developers master functional-style data processing in Java.
This comprehensive tutorial explains Java 8's Stream API and Lambda expressions, demonstrating how to create streams from collections and arrays, perform intermediate operations like filter, map, flatMap, and sorted, and use terminal operations such as forEach, findFirst, reduce, and collect through twenty detailed code examples covering employee data processing, aggregation, grouping, and sorting.
This article explains why Java generics were introduced, outlines their benefits for type safety and code clarity, demonstrates common generic interfaces and collections, dives into usage details such as inheritance and shorthand forms, and shows how to create custom generic classes, methods, and avoid typical pitfalls.
This article demonstrates four Java 8 Stream API techniques for comparing two List collections and retrieving the elements that differ, including simple filtering, concatenation, grouping by occurrence, and attribute‑based comparison with custom DTOs.
This article examines several Java deduplication techniques—including List.contains, HashSet, double-loop removal, and Stream.distinct—by providing sample code, measuring execution time on a 20,000‑element list, and analyzing their time complexities to guide developers toward efficient duplicate‑removal strategies.
This article provides a comprehensive overview of Java's collection framework, explaining the differences between List, Set, Queue, and Map, detailing their underlying data structures, and offering best practices for safe traversal and modification.
This article explores Google Guava’s rich set of utilities—including Joiner, Splitter, CharMatcher, Multiset, Multimap, BiMap, Table, Functions, Predicate, Optional, Preconditions, and Cache—demonstrating how they simplify string handling, collections, immutability, caching, and asynchronous callbacks for more elegant Java development.
Guava is Google's open‑source Java core library offering utilities such as data validation, immutable collections, caching, and string handling; this article introduces the library and provides ten detailed tutorial links covering Optional, Preconditions, Ordering, concurrency tools, range operations, collection helpers, caching, and more.
This article explores Google Guava’s most useful utilities—including Joiner, Splitter, CharMatcher, Multiset, Immutable collections, Multimap, BiMap, Table, Functions, Predicate, and Cache—showing how they simplify string handling, collection manipulation, caching, and asynchronous callbacks, with practical code examples and performance insights.
This article explains why specifying an initial capacity for Java's HashMap matters, demonstrates common mistakes, walks through the source‑code calculation of the capacity and resize threshold, and provides guidelines on choosing the correct capacity to avoid unnecessary rehashing and improve performance.
This article introduces Google Guava's powerful utilities—including Joiner, Splitter, CharMatcher, Multiset, Multimap, BiMap, Table, Functions, Predicate, Cache, and asynchronous callbacks—explaining their advantages over standard JDK classes and demonstrating practical usage with code examples for Java developers.
This article provides an in‑depth tutorial on Java 8 Stream operations—including creation, intermediate and terminal operations, parallel streams, reduction, collection, and conversion—followed by a detailed explanation of the Optional class with examples of creation, presence checks, default values, filtering, mapping, and practical usage patterns.