Java

How to sort list of objects using multiple fields?

We can sort list using multiple fields with Comparator. Here we are going to see two ways to do that. Let’s say we have a Student class as below. And a list of Students. private List<Student> getStudentList() { return Arrays.asList(new Student(1, “Bindu”, “IT”), new Student(2, “Sam”, “CS”), new Student(3, “David”, “IT”), new Student(4, “Anjali”, “CS”)); …

How to sort list of objects using multiple fields? Read More »

Streams in Java 8

Streams in Java – Quick Guide with Examples

Java introduced Stream API in java 8, which is useful to perform operations on collections. Java streams have definitely made processing collections and life easier. But in order to work with streams, it’s important to understand following: Functional programming Functional Interface Lambda Expression Here I am going to explain all three concepts to help you …

Streams in Java – Quick Guide with Examples Read More »