Links for Eclipse Collection
https://piotrminkowski.com/2021/06/22/using-eclipse-collections/
https://sendilkumarn.com/blog/eclipse-collections
https://donraab.medium.com/getting-started-with-eclipse-collections-part-1-d5ba0098465f
Guava
Suppose, we have a list of Employee objects where we want to create a Map from the list with employee id as Key. You can do that with Java Stream, but with Guava the code becomes more concise. Below is the example:
Add Guava in Maven dependency:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.3.1-jre</version>
</dependency>
@Data
public class Employee() {
private int id;
private String name;
}
Map<Integer, Employee> employeeMap = Maps.uniqueIndex(employeeList, Employee::id);
If you want to create Map<Integer,List<Employee>> then use below
ImmutableListMultimap<Integer, Employee> employeeMap = Multimaps.index(employeeList, Employee::id);
https://howtodoinjava.com/java/collections/convert-list-to-map/
https://spring.io/blog/2024/09/26/ai-meets-spring-petclinic-implementing-an-ai-assistant-with-spring-ai-part-i https://www.sivalabs.in/sprin...