Java JDBC Tutorials
The Java Database Connectivity (JDBC) API enables Java application to interact with database. 1. Getting Started JDBC + Oracle database JDBC + MySQL database JDBC + PostgreSQL database 2. Statement…
Favourite tutorials for developers
The Java Database Connectivity (JDBC) API enables Java application to interact with database. 1. Getting Started JDBC + Oracle database JDBC + MySQL database JDBC + PostgreSQL database 2. Statement…
This article shows few Java examples to get the current date time or timestamp in Java. (Updated with Java 8): 1 - uses java.sql.Timestamp to get the current timestamp and…
In this tutorial, we will show you how to get the current date time from the new Java 8 java.time.* like Localdate, LocalTime, LocalDateTime, ZonedDateTime, Instant and also the legacy…
In Java 8, Stream cannot be reused, once it is consumed or used, the stream will be closed. If we reuse the stream it will throw an IllegalStateException, saying “stream…
The sum() method is available in the primitive int-value stream like IntStream, not Stream. We can use mapToInt() to convert a stream integers into a IntStream.
Few examples to show you how to sort a List with stream.sorted(): Sort a List with Comparator.naturalOrder(), Sort a List with Comparator.reverseOrder(), Sort a List user objects.
Few Java 8 examples to get a primitive int from an IntStream. We can convert IntStream to primitive int array.
How to convert IntStream to Integer array? The key is boxed() the IntStream into a Stream, then only convert to an Array.
Streams have a BaseStream.close() method and implement AutoCloseable, but nearly all stream instances do not actually need to be closed after use. Generally, only streams whose source is an IO…