Tagged articles
13 articles
Page 1 of 1
MaGe Linux Operations
MaGe Linux Operations
Jul 15, 2024 · Fundamentals

Why Python’s ‘is’ Returns False for Identical Numbers and Other Gotchas

This article explains why Python’s is operator can yield False for seemingly identical integers, how integer caching and code‑block reuse affect object identity, common pitfalls with re.sub’s count parameter, the character‑based behavior of lstrip, and why list multiplication creates shared references.

Pythoninteger cachingis-operator
0 likes · 8 min read
Why Python’s ‘is’ Returns False for Identical Numbers and Other Gotchas
Architecture Digest
Architecture Digest
Sep 12, 2023 · Fundamentals

Understanding Java Integer Caching and the == Operator

This article explains how Java caches Integer objects in the range -128 to 127, why the == operator behaves differently for small and large integers, and demonstrates how to inspect and manipulate the cache using reflection.

JavaMemory OptimizationReference Equality
0 likes · 4 min read
Understanding Java Integer Caching and the == Operator
Java Captain
Java Captain
Mar 1, 2022 · Fundamentals

Understanding Java Integer Caching and the == Operator

This article explains why comparing Integer objects with == yields false for large values but true for small values due to Java's internal IntegerCache, demonstrates the caching mechanism with code examples, and shows how reflection can manipulate the cache, highlighting memory optimization considerations.

JavaMemory OptimizationReference Equality
0 likes · 4 min read
Understanding Java Integer Caching and the == Operator
Java Backend Technology
Java Backend Technology
Nov 27, 2017 · Fundamentals

Why Swapping Two Integers Fails in Java? Exploring Pass‑by‑Value, Handles, and Integer Caching

This article dissects a Java interview question about swapping two Integer variables, explaining Java's pass‑by‑value semantics, the difference between handle‑based and direct pointer object access, Integer immutability, autoboxing, the IntegerCache mechanism, and how reflection can (or cannot) modify private final fields.

AutoboxingJDKReflection
0 likes · 10 min read
Why Swapping Two Integers Fails in Java? Exploring Pass‑by‑Value, Handles, and Integer Caching