Java Stream max() and min() Examples: Find Max and Min Values
Java Stream max() and min() find the largest and smallest element with a Comparator. Covers ties, empty streams, nulls, max per group and IntStream.
“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, etc. This is mostly to differentiate from others like Java ME or Java EE. “Core Java” is Oracle’s definition and refers to subset of Java SE technologies.
The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications.
Java Stream max() and min() find the largest and smallest element with a Comparator. Covers ties, empty streams, nulls, max per group and IntStream.
Read the HttpServletRequest body multiple times with a caching request wrapper for Jakarta Servlet 6.1, with a size limit, tests and a webhook example.
Java Stream count() returns the number of elements as a long. Count matches with filter(), groups with counting(), and see when count() skips the pipeline.
Java boxed stream guide with IntStream boxed() and mapToObj(), collecting primitive streams into a List, Set, Map or array, unboxing and boxing cost.
Docker hello world for Java developers. Write a Dockerfile for a Java 25 app, run it, use a multi-stage build, shrink it with jlink and set JVM memory.
Java modules tutorial for Java 25. Write module-info.java, use requires, exports, opens and services, fix module errors, and build with jlink.
Dozer bean mapping with Dozer 7 (XML, annotations, API, custom converters), its inactive status, and how to migrate to MapStruct or ModelMapper.
JShell tutorial for Java 25. Run Java snippets without a class, use /vars, /list, /save and /open, add JARs, run scripts and learn the default imports.
Java Stream takeWhile and dropWhile explained with examples, the difference from filter() and limit(), unordered streams, iterate() and ofNullable().
Immutable collections factory methods List.of(), Set.of() and Map.of() in Java 25, with null and duplicate rules, copyOf(), toList() and Arrays.asList().
Private methods in interfaces let default and static methods share code without exposing it. Learn the rules, the compile errors and a real example.
Learn the static keyword in Java for variables, methods, blocks, nested classes and imports, method hiding, thread safety and instance main in Java 25.
Java constructor types with examples. Default vs no-arg, parameterized, this() and super() chaining, Java 25 flexible constructor bodies and records.
Java inheritance explained with extends and super, what a subclass inherits, types of inheritance, final and sealed classes, and composition.
JSON.simple examples to read and write JSON files in Java, its status since 2012, common pitfalls, and the same code with Jackson and Gson.
Read XML with JDOM2 in Java. Secure SAXBuilder setup, elements, attributes, namespaces, XPath with Jaxen, writing back and library status on Java 25.
Learn to read a file to String in Java with Files.readString() (Java 11), Files.readAllBytes(), Files.readAllLines() and lines(), BufferedReader, Scanner and FileInputStream, plus how to read from the classpath, avoid charset and line separator mistakes and stream large files.
Remove non-ASCII and non-printable characters in Java with \P{ASCII}, \p{Cntrl} and \p{C}, keep line breaks, and turn accents into ASCII with Normalizer.
Java method references explained with the lambda each one replaces. Static, bound, unbound and constructor references, plus ambiguity and null errors.
Convert byte array to String in Java with the right charset, go back with getBytes(), and use Base64 or HexFormat for binary data.
Convert a Java String to int with Integer.parseInt() and valueOf(), handle NumberFormatException safely, and parse hex, big numbers, chars and input.
Learn to create a Java enum with String values, convert an enum to a String with name(), toString() or a getter, and convert a String back to an enum safely with valueOf() or a case-insensitive lookup that returns Optional.
Convert a comma-separated string to list in Java with split(), Arrays.asList(), List.of() and streams, handling spaces, empty values and numbers.
Java custom serialization with private readObject() and writeObject(), defaultWriteObject(), validation after reading, readResolve() and records.
Write a FizzBuzz program in Java with a for loop, streams, a switch expression and no modulo, learn why 15 comes first, and handle custom divisors.
Association, aggregation and composition in Java with UML notation, code that enforces ownership, a comparison table, JPA cascade mapping and FAQs.
Build a Java CORS filter for Jakarta Servlet 6.1 that handles preflight requests, credentials and an origin allowlist, or configure Tomcat’s CorsFilter.
Bypass SSL certificate checking in Java only in local tests, and fix PKIX errors safely with a truststore, a trusted PEM certificate or Spring SSL bundles.
Java Stream distinct() removes duplicates with equals() and hashCode() and keeps encounter order. Examples with strings, records, keys and parallel use.
List all files in a directory in Java with Files.list, Files.walk, Files.find and DirectoryStream, incl. recursion, filters by extension and errors.
Java WatchService tutorial with register, poll, take, reset, OVERFLOW handling, recursive watching, single-file reloads and macOS and Linux caveats.
Resolve prefixes with a Java XPath NamespaceContext. Map-based resolver, default namespace, namespaced attributes, nested prefixes and local-name().
Convert OutputStream to InputStream in Java with ByteArrayOutputStream, piped streams in a second thread or a temp file, and avoid pipe deadlocks.
Learn to find the missing number in an array in Java with the sum formula, XOR, binary search and BitSet, including overflow, unsorted input and gaps.
Java Locale examples on Java 25. Create locales with Locale.of() and forLanguageTag(), set the default, match Accept-Language and format dates and numbers.
Unzip a file in Java with ZipFile or ZipInputStream, extract subdirectories, block zip slip and zip bombs, and read archives as a zip file system.
Get the current working directory in Java with user.dir, Path.of(“”) and File, plus normalize(), JAR location and why changing user.dir breaks paths.
Use XMLEncoder and XMLDecoder to save Java objects as XML, handle errors with ExceptionListener, store records and avoid decoding untrusted XML.
Externalizable vs Serializable in Java with a runnable example, constructor rules, read order, real size numbers, versioning, records and security.
Generate random numbers in Java with Math.random(), Random, ThreadLocalRandom, SplittableRandom, the Java 17 RandomGenerator and SecureRandom.
Learn how the Java classpath works, set it with -cp or CLASSPATH on Windows and Linux, use lib/* wildcards, fix NoClassDefFoundError, compare sourcepath.
Learn to read a file from the resources folder in Java with getResourceAsStream(), slash rules, why File fails in a JAR, and Spring ResourceLoader.
ClassNotFoundException for org.apache.commons.fileupload.FileItemFactory means the JAR is missing. Fix it for Spring 6, Jakarta servlets and legacy apps.
Java OOP concepts explained with runnable Java 25 examples of abstraction, encapsulation, inheritance and polymorphism, plus records and sealed types.
Write a factorial program in Java with a loop, recursion, streams and BigInteger, detect long overflow after 20!, reject negatives and count combinations.
Solve the producer consumer problem in Java with BlockingQueue, put() and take(), a poison pill per consumer, timeouts and virtual threads.
How to iterate a collection in Java with for-each, forEach(), Iterator, index loops and streams, remove elements safely and compare loop performance.
Binary, octal, hex and decimal conversion in Java with parseInt() and toString() radix, padding, prefixes, negative numbers, Long and BigInteger.
Learn to reverse a string in Java with StringBuilder, two pointers, recursion and streams, reverse word order, and keep emoji and accents intact.
Learn the thread life cycle in Java with all six Thread.State values, a state diagram, runnable demos, transitions, virtual threads and thread dumps.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.