# Alantushenko Java

> Use whenever writing, editing, reviewing, or refactoring Java code. Alex Lantushenko's Java conventions for readable, maintainable code.

- Skill: `lantushenko-alex/alantushenko-java` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lantushenko-alex/alantushenko-java`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lantushenko-alex/alantushenko-java/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lantushenko-alex (https://skillmd.com/u/lantushenko-alex)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/lantushenko-alex/alantushenko-java

---


# alantushenko-java — Java Conventions

Apply these conventions whenever writing or modifying Java code. These are additive to the general `alantushenko` style; where they conflict, the more specific Java rule here wins over the general style, but repository conventions still win over both.

## 1. Never assign null to a Boolean

A `Boolean` holds `true` or `false` — never set one to `null`. A third state forces every use site to guard against it. When a `Boolean` arrives from outside code you control (JSON, database, third-party API), turn `null` into `false` at that boundary with `Boolean.TRUE.equals(value)`.

```java
// Avoid
Boolean isActive = null;
if (isActive != null && isActive) { activate(); }

// Prefer
Boolean isActive = false;
if (isActive) { activate(); }
```

## 2. Treat null and empty the same for arrays and strings

For arrays and strings, `null` and empty both mean "no value". Process them in one branch, not two.

```java
// Avoid
if (name == null) { throw new IllegalArgumentException("name is missing"); }
if (name.isEmpty()) { return DEFAULT_NAME; }

// Prefer
if (name == null || name.isEmpty()) { return DEFAULT_NAME; }
```

Use `ArrayUtils.isEmpty` / `StringUtils.isEmpty` if the project already has Apache Commons; otherwise one small shared helper.

