Skip to main content

32 docs tagged with "java"

View all tags

Building a REST API

Build a REST API with Java's built-in HttpServer -- HTTP basics, request handling, JSON serialization, routing, and exposing the task manager over HTTP.

Classes & Objects

Learn Java OOP basics -- classes, objects, constructors, access modifiers, encapsulation, toString, equals/hashCode, static members, and records.

Collections

Learn Java collections -- ArrayList, HashMap, HashSet, iterating, generics, immutable collections, and choosing the right collection.

Control Flow

Learn Java control flow -- if/else, switch expressions, for/while/do-while loops, enhanced for-each, break, continue, and common patterns.

Deploying to a VPS with Nginx

Deploy your Java REST API to a VPS -- installing the JDK, running as a systemd service, configuring nginx as a reverse proxy, and HTTPS with Let's Encrypt.

Error Handling

Learn Java error handling -- try/catch/finally, checked vs unchecked exceptions, custom exceptions, try-with-resources, and best practices.

File I/O

Learn Java file I/O -- Path, Files, reading and writing text files, directories, BufferedReader/Writer, and simple CSV parsing.

Functional Interfaces and Lambdas

Java functional interfaces guide: Function, Predicate, Consumer, Supplier, method references, composition, and writing custom functional interfaces.

Generics and Type Erasure

Java Generics guide: generic classes, methods, bounded types, wildcards, PECS principle, type erasure, and common patterns.

Gradle

Learn Gradle with Kotlin DSL -- project structure, dependency management, building fat JARs, and improving the REST API project with Jackson for JSON handling.

Inheritance & Interfaces

Learn Java inheritance, method overriding, abstract classes, interfaces, polymorphism, sealed classes, and composition vs inheritance.

Java Best Practices in AEM

This page collects practical Java guidelines for AEM projects. The goal is consistent, safe code that is easy to test and maintain.

JSON Processing: Jackson and Gson

Java JSON processing guide: Jackson ObjectMapper, annotations, custom serializers, polymorphism, Gson comparison, and common pitfalls.

Maven

Learn Apache Maven -- project structure, dependency management, building fat JARs, and improving the REST API project with Gson for JSON handling.

Methods

Learn Java methods -- defining and calling static methods, parameters, return types, overloading, varargs, scope, and recursion.

Optionals

Avoid NullPointerException with Java's Optional -- creation, unwrapping, chaining, and best practices for handling missing values.

Project: CLI Task Manager

Build a complete command-line task manager in Java -- CRUD operations, file-based persistence, input validation, and packaging as a runnable JAR.

Streams & Lambdas

Functional Java -- lambda expressions, method references, the Stream API, and practical data processing pipelines.

Streams and Collectors

Java Streams API guide: filter, map, flatMap, reduce, collect, groupingBy, parallel streams, and common pitfalls with practical examples.

Testing

Write your first Java tests -- JUnit 5 setup, assertions, test structure, parameterized tests, and testing the Task Manager and REST API.

Variables, Types & Operators

Learn Java's primitive types, String basics, type casting, var, final, arithmetic, comparison, and logical operators.