TAG · 13 ARTICLES
#python-for-java-developers
Python for Java Developers
- JAVAPython async and await vs Java CompletableFuture and virtual threadsLLM calls are slow and mostly waiting. Python's async lets one thread wait on many of them at once, pausing at every await. Here is how async def, await and asyncio.gather compare with CompletableFuture and virtual threads, and the rules that keep async code from freezing.29 Nov 2026 · 5 min
- JAVAPython classes for Java developers: __init__, self, dataclasses and PydanticA Python class is a Java class with less typing: __init__ is the constructor, self is this, and there's no new. Then come the two shortcuts you'll see everywhere: @dataclass, Python's record, and Pydantic, a record that validates its data.29 Nov 2026 · 5 min
- JAVAPython decorators vs Java annotations: same @, different idea@app.get("/health") looks exactly like Spring's @GetMapping. It isn't the same thing. A Java annotation is metadata a framework reads later; a Python decorator is a function that runs right away and wraps or registers yours. Here is how they work, and how to read the ones you'll meet.29 Nov 2026 · 5 min
- JAVAPython for Java developers: the 10 differences that matterYou don't need to learn Python from zero. You already know loops, classes, collections and exceptions. Here are the ten things that actually change when a Java developer moves to Python, each with side-by-side code.29 Nov 2026 · 7 min
- JAVAPython for loops for Java developers: range, enumerate and zipPython has no for (int i = 0; i < n; i++). Every for loop walks over items, and three small helpers, range, enumerate and zip, cover every counting loop you used to write in Java. Plus if/elif, the ternary, and match as Python's switch.29 Nov 2026 · 3 min
- JAVAPython functions for Java developers: default and keyword argumentsPython has no method overloading and almost no builders, and it doesn't miss them. Default values and keyword arguments do the same job in one function. Here is how def, *args, **kwargs and lambda work, compared with the Java you know.29 Nov 2026 · 4 min
- JAVAPython list comprehensions vs Java streamsA list comprehension does the work of stream().filter().map().toList() in one readable line. Here is how to read one, how every common stream operation maps to Python, and when a plain loop is the better choice.29 Nov 2026 · 5 min
- JAVAPython list and dict vs Java ArrayList and HashMapPython's collections are built into the language, with their own literal syntax. Here is every ArrayList, HashMap and HashSet method you use daily, mapped to its Python form, plus slicing, tuples and the list-of-dicts shape that carries all JSON and AI data.29 Nov 2026 · 5 min
- JAVAPython pip, venv and uv vs Maven: project setup for Java developersNo pom.xml, no ~/.m2, no classpath. Python has modules and packages, installs dependencies into a virtual environment per project, and now has uv to do Maven's job in one fast tool. Here is how a Python project is laid out and run, mapped to the Maven world you know.29 Nov 2026 · 6 min
- JAVAPython exceptions for Java developers: try, except, raiseSame model as Java, new words: catch becomes except, throw becomes raise, and nothing is checked. Here is how Python error handling works, which built-in errors map to which Java exceptions, how to read a traceback, and the Pythonic habit of asking forgiveness.29 Nov 2026 · 5 min
- JAVAPython type hints vs Java generics: what Java developers need to knowPython lets you write types, and modern code does. But Python itself never checks them when your program runs. Here is the type hint syntax mapped to Java, how to get compiler-like checking with mypy or pyright, and why AI libraries turn hints into real behaviour.29 Nov 2026 · 5 min
- JAVAPython variables, None and truthiness for Java developersNo types on variables, None instead of null, == that means equals(), and an if that accepts a list. Here is how Python variables really work, explained from the Java side, with the traps that catch every Java developer once.29 Nov 2026 · 3 min
- JAVAPython with and yield for Java developers: context managers and generatorswith is Python's try-with-resources, and yield turns a plain function into a lazy iterator. Together they power file handling, database connections and the word-by-word streaming of LLM answers. Here is how both work, compared with the Java you know.29 Nov 2026 · 5 min