Tag

ternary operator

0 views collected around this technical thread.

Cognitive Technology Team
Cognitive Technology Team
Apr 22, 2025 · Fundamentals

Understanding the Ternary Operator and NullPointerException in Java

This article explains Java's ternary operator syntax, demonstrates how mixing primitive and wrapper types can trigger NullPointerException due to automatic unboxing, and provides code examples and best‑practice notes to help developers avoid such pitfalls.

JavaUnboxingboxing
0 likes · 3 min read
Understanding the Ternary Operator and NullPointerException in Java
Python Programming Learning Circle
Python Programming Learning Circle
Apr 8, 2024 · Fundamentals

Common Python One‑Line Code Snippets and Tricks

This article presents a collection of concise Python one‑line code snippets—including ternary operators, multiple variable assignments, list swapping, list comprehensions, dictionary and set comprehensions, file handling, and command‑line one‑liners—demonstrating how to write more compact and readable code.

One‑Linercode snippetslist comprehension
0 likes · 9 min read
Common Python One‑Line Code Snippets and Tricks
php中文网 Courses
php中文网 Courses
Jul 3, 2023 · Backend Development

Understanding PHP's Ternary Operator

The article explains PHP's ternary operator, covering its basic syntax, equivalence to if‑else statements, usage examples, extensions with multiple statements, nesting, best practices, and common pitfalls, providing clear code illustrations for developers seeking concise conditional expressions.

PHPbackend developmentcode simplification
0 likes · 6 min read
Understanding PHP's Ternary Operator
Python Programming Learning Circle
Python Programming Learning Circle
Apr 19, 2023 · Fundamentals

Hidden Python Tricks: Ternary Operator, enumerate, zip, List Comprehensions, Lambdas, Generators, Decorators and More

This article introduces a collection of lesser‑known Python techniques—including the ternary operator, enumerate, zip, list comprehensions, lambda functions, any/all, itertools, generators, decorators, dynamic imports, dictionary comprehensions, and mutable data structures—each explained with clear examples to help developers write more concise and efficient code.

GeneratorsProgramming tricksPython
0 likes · 10 min read
Hidden Python Tricks: Ternary Operator, enumerate, zip, List Comprehensions, Lambdas, Generators, Decorators and More
php中文网 Courses
php中文网 Courses
Nov 7, 2022 · Frontend Development

Improving JavaScript Conditional Logic: Short‑Circuit, Ternary, Switch, and Strategy Pattern

This article explains how to replace verbose nested if‑else statements in JavaScript with short‑circuit evaluation, ternary operators, switch‑case constructs, and object‑based strategy patterns, providing clearer, more maintainable code through concise examples and practical use‑cases.

Conditional StatementsJavaScriptShort-Circuit
0 likes · 7 min read
Improving JavaScript Conditional Logic: Short‑Circuit, Ternary, Switch, and Strategy Pattern
Cognitive Technology Team
Cognitive Technology Team
May 9, 2022 · Fundamentals

Understanding the Ternary Operator and NullPointerException in Java

This article explains Java's ternary operator syntax, its equivalent if‑else form, and how mixing primitive and wrapper types can trigger a NullPointerException through automatic unboxing, illustrated with code examples and a discussion of related type‑conversion rules.

JavaType ConversionUnboxing
0 likes · 3 min read
Understanding the Ternary Operator and NullPointerException in Java
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Apr 21, 2021 · Backend Development

Mastering Aviator: Advanced Java Expression Engine Examples

This guide demonstrates how to use the Aviator 5.2.5 expression engine on Java 8 with practical examples covering ternary operators, regex matching, variable shortcuts, nil handling, date comparisons, big number calculations, the powerful seq library, execution modes, and debugging techniques.

BigDecimalJavaaviator
0 likes · 7 min read
Mastering Aviator: Advanced Java Expression Engine Examples
macrozheng
macrozheng
May 22, 2020 · Backend Development

Why Java’s Ternary Operator Can Trigger NullPointerException with Autoboxing

This article explains how the combination of Java's ternary operator and automatic boxing/unboxing can unintentionally cause a NullPointerException, demonstrates the issue with decompiled code, and provides a safe coding pattern to avoid the runtime error.

Javaautoboxingbackend
0 likes · 7 min read
Why Java’s Ternary Operator Can Trigger NullPointerException with Autoboxing
Amap Tech
Amap Tech
Apr 24, 2020 · Backend Development

Introducing the Java Development Manual (Taishan Edition): Unified Error Codes, Leap‑Year Pitfalls, SQL Alias, Code‑Style Tips, and Ternary‑Operator NPE Issues

The new Java Development Manual (Taishan Edition) adds 34 rules and revises 90 descriptions, introduces a unified five‑character error‑code scheme, warns about stream‑toMap and ternary‑operator null‑pointer traps, highlights leap‑year and SQL alias bugs, and recommends readability tweaks such as blank lines after returns.

Error CodesJavaSQL
0 likes · 8 min read
Introducing the Java Development Manual (Taishan Edition): Unified Error Codes, Leap‑Year Pitfalls, SQL Alias, Code‑Style Tips, and Ternary‑Operator NPE Issues