Java 8: Convert Array to List – Arrays.asList() vs Stream.of() vs Arrays.stream()

Converting an array to a list in Java is a common requirement, whether you’re working with collections, processing data, or leveraging Java’s Stream API. In Java 8, there are multiple ways to achieve this, including Arrays.asList(), Stream.of(), and Arrays.stream() with Collectors.toList(). Each method has its own advantages and limitations—some create fixed-size lists, while others generate … Read more

Optional in details Java 8

Optional were introduced in Java 8 version as part of the java.util package. It is designed to provide a more explicit and safer way to handle null value instead of applying multiple null checks. The main purpose of Optional is to eliminate null pointer exceptions and make your code more readable and expressive. Example to … Read more