Posts

Showing posts from December, 2019

Java 8 | Writing custom Stream API using builder pattern

In this post we are going to create simple Java 8   Stream API using builder pattern. Check builder pattern post here .  API will provide below four methods - sort - Sort the list limit - Fetch only N numbers from the list distinct - Remove duplicates from the list forEach - Print the list

Java 8 | Fetch top N unique numbers from list

Below Java 8 example shows how to fetch top N unique numbers from ArrayList. Traditional looping will require more logic to first remove duplicates, sort numbers and then store N numbers to different list. Java 8 provides stream API to do all the above steps in single line of code.  Descending order (N = 3)

NodeJS | Simple Tweet API

Image
This post is about simple tweet api created using NodeJs and MongoDB. You can get a code from  Github link . Below REST APIs are provided. We need to have Node installed   before using this project. ExpressJS is used with MongoDB to store tweets.