Master core Java programming - syntax, OOP, collections, streams, and exception handling
Java Fundamentals Skill
Master core Java programming with production-quality patterns.
Overview
This skill covers Java fundamentals including syntax, OOP, collections, streams API, and exception handling for Java 8-21.
When to Use This Skill
Use when you need to:
- Write clean, idiomatic Java code
- Design classes following OOP principles
- Choose appropriate collection types
- Implement functional programming patterns
- Handle exceptions properly
Topics Covered
Core Syntax (Java 8-21)
- Variables, data types, operators
- Control flow, methods, classes
- Records (Java 16+), sealed classes (Java 17+)
- Pattern matching (Java 21)
Object-Oriented Programming
- Classes, inheritance, polymorphism
- Interfaces and abstract classes
- SOLID principles
Collections Framework
- List: ArrayList, LinkedList
- Set: HashSet, TreeSet
- Map: HashMap, ConcurrentHashMap
- Queue: ArrayDeque, PriorityQueue
Streams API
- filter, map, flatMap, reduce, collect
- Optional handling
- Parallel streams
Exception Handling
- Checked vs unchecked exceptions
- Try-with-resources
- Custom exceptions
Quick Reference
// Record (Java 16+)
public record User(String name, String email) {}
// Pattern matching (Java 21)
String format(Object obj) {
return switch (obj) {
case Integer i -> "Int: %d".formatted(i);
case String s -> "String: %s".formatted(s);
default -> obj.toString();
};
}
// Stream operations
List<String> names = users.stream()
.filter(User::isActive)
.map(User::getName)
.sorted()
.toList();
// Optional handling
String name = Optional.ofNullable(user)
.map(User::getName)
.orElse("Unknown");
Collection Selection
| Need | Use | Reason |
|---|---|---|
| Indexed access | ArrayList | O(1) random access |
| Unique elements | HashSet | O(1) contains |
| Sorted unique | TreeSet | O(log n) sorted |
| Key-value pairs | HashMap | O(1) get/put |
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| NullPointerException | Null reference | Use Optional |
| ConcurrentModificationException | Modify during iteration | Iterator.remove() |
| ClassCastException | Wrong type | Use generics |
Usage
Skill("java-fundamentals")
You Might Also Like
Related Skills

coding-agent
Run Codex CLI, Claude Code, OpenCode, or Pi Coding Agent via background process for programmatic control.
openclaw
add-uint-support
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
pytorch
at-dispatch-v2
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
pytorch
skill-writer
Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.
pytorch
implementing-jsc-classes-cpp
Implements JavaScript classes in C++ using JavaScriptCore. Use when creating new JS classes with C++ bindings, prototypes, or constructors.
oven-sh
implementing-jsc-classes-zig
Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration.
oven-sh