Loading…
Loading…
Topic
Articles and problems tagged Concurrency.
Every way to initialize Java objects: overloading and signatures, default field values, no-argument constructors, field initializers, parameter naming with this, calling this(...), initialization blocks, static initializers, construction order and cleanup without destructors.
How Java blocks define variable scope (and why you can't redeclare a variable in a nested block), and how to make decisions with if, if/else and if/else if chains, including the dangling else, braces style, and common pitfalls like a stray semicolon.
A working tour of the String API (strip, startsWith, replace, indexOf ranges, formatted, lines, isBlank and more), how to read the Javadoc, iterating over code points correctly, building strings fast with StringBuilder, and writing multi-line text with text blocks.
Keep Java desktop apps responsive: why the UI thread must never block, how to run work in background threads, update components safely with EventQueue.invokeLater, and use SwingWorker's doInBackground, publish, process, done and cancel, plus JavaFX and Android equivalents.
Write non-blocking Java code with CompletableFuture: supplyAsync, thenApply, thenCompose, thenAccept, exceptionally, handle, timeouts, thenCombine, allOf and anyOf, completing futures yourself, cancellation and building clean asynchronous pipelines.
Update a Java ConcurrentHashMap atomically with compute, merge and computeIfAbsent, run parallel search, forEach and reduce bulk operations, build concurrent sets, use copy-on-write lists, parallelSort, parallelSetAll and parallelPrefix, and compare synchronization wrappers.
Coordinate Java threads without explicit locks: BlockingQueue put and take, offer and poll with timeouts, ArrayBlockingQueue, LinkedBlockingQueue, PriorityBlockingQueue, TransferQueue, DelayQueue, poison pills, ConcurrentSkipListMap and weakly consistent iterators.