16/10/2024
List.of and Arrays.asList are both used to create lists in Java, but they have some differences:
1. List.of()
Introduced in Java 9.
Creates an immutable list.
Does not allow null elements.
Returns a list with a fixed size.
2. Arrays.asList()
Available since Java 1.2.
Creates a mutable list backed by an array.
Allows null elements.
The size of the list is fixed, but the elements can be changed.
Ref: https://websparrow.org/java/arrays-aslist-vs-list-of-in-java
Arrays.asList() vs. List.of() in Java - Websparrow
List.of and Arrays.asList are both used to create lists in Java, but they have some differences.
16/10/2023
https://javatonline.com/
Redirecting...
Tutorials, Free Online Tutorials, javaTonline provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.
16/10/2023
https://websparrow.org/spring/spring-boot-commandlinerunner-interface-example
Spring Boot CommandLineRunner Interface Example - Websparrow
Spring Boot’s CommandLineRunner interface, allows developers to execute code when the Spring Boot application starts. In this blog, we’ll explore the CommandLineRunner interface, and its purpose, and provide examples of its usage.
11/10/2023
Understanding Git Squash
The “git squash” enables you to merge multiple commits into a single, cleaner commit. This means that instead of having a long and cluttered commit history, you can group related changes together, making it easier to navigate through your project’s history.
Why Squash Commits?
Squashing commits can be particularly beneficial for several reasons:
Full artilce URL: https://websparrow.org/git/git-squash-squashing-commits-for-a-cleaner-history
Git Squash: Squashing Commits for a Cleaner History - Websparrow
git squash is a technique for combining multiple commits into a single, more coherent commit using the interactive rebase feature in Git.
11/10/2023
Hibernate Annotation
The annotation is a part of the Java Persistence API (JPA) standard and is used to implement optimistic concurrency control in Hibernate. This mechanism ensures that multiple users can work with the same data simultaneously without causing data inconsistencies or conflicts. It’s particularly useful in applications where concurrent access to data is common.
Why and Where to Use Annotation?
Full article: https://websparrow.org/hibernate/hibernate-version-annotation
Hibernate @Version Annotation - Websparrow
Unlocking Optimistic Concurrency Control with Hibernate Annotation. What is the Annotation? What is preferred data type for annotation in Hibernate?
07/09/2023
https://websparrow.org/java/exploring-the-optional-in-java-8
Exploring the Optional in Java 8 - Websparrow
The Optional class in Java 8 provides a more elegant and safer way to handle the absence of a value. It is part of the java.util package.
21/08/2023
Java 8 new Date and Time API
https://websparrow.org/java/overview-of-java-8-date-and-time-api
Overview of Java 8 Date and Time API - Websparrow
Explore Java 8's Date and Time API: Advancements, examples & ISO-8601 format. Master handling dates, times, and durations effortlessly.
20/08/2023
https://websparrow.org/java/lambda-expressions-in-java-8
Lambda Expressions in Java 8 - Websparrow
Java 8 brought a game-changing feature to the world of programming: lambda expressions. Lambda expressions are a way to define anonymous (unnamed) functions in Java.
30/07/2023
Java 8 Collectors.groupingBy() Method
=====================================
The Collectors.groupingBy() method is part of the java.util.stream package, introduced in Java 8, and facilitates the grouping of elements in a stream based on a provided classification function. The elements of the stream are divided into different groups, where each group is represented by a unique key.
https://websparrow.org/java/java-8-collectors-groupingby-method-example
Java 8 Collectors.groupingBy() Method Example - Websparrow
The Collectors.groupingBy() method is part of the java.util.stream package, introduced in Java 8 and facilitates the grouping of elements in a stream based on a provided classification function.