Bindu Shrestha

Why do we get CORS error and how to resolve it?

If you have been developing REST APIs that are consumed by front end applications, it’s likely that you’ve come across this error, which is annoying for both frontend and backend developers. So let’s start with why we get this error? It’s because browsers don’t allow application from a origin to access resources on a different …

Why do we get CORS error and how to resolve it? Read More »

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 »