Java8 lamda expressions
Lambda expressions are a concise way of representing anonymous functions in Java 8 and later. A lambda is an anonymous function They can be used to pass behavior as a…
Lambda expressions are a concise way of representing anonymous functions in Java 8 and later. A lambda is an anonymous function They can be used to pass behavior as a…
In this post, we will learn on java8 method referenced exampls: Method references in Java 8 are compact, easy-to-read lambda expressions which will refer to an existing method. They can…
In this tutorial, we will learn about using comparators with Lamda. Comparators are extensively used in collections to sort objects link users, employees, orders etc. In Java 8, comparators can…
Comparable and Comparator are two Java interfaces that allow objects to be compared and sorted. Comparable Comparable is a functional interface that is implemented by a class to define its…
ConcurrentHashMap and Hashtable are both classes in Java that provide thread-safe implementations of the Map interface. However, there are some key differences between the two: Synchronization: Hashtable is synchronized, meaning…
cd /etc/ssh vi sshd.config Lets see the ssh port that linux is running service sshd status ------------------------------------------------------------------- Nov 29 15:19:09 centos-vps-1 sshd[840]: Server listening on :: port 22. Nov 29…
In this post, we will see the java is pure functional programming language or not. Java is not a purely functional programming language support functional programming concepts with help of…
Problem: Given array of size ‘n’ and left rotate k times Input : [1,2,3,4,5,6,7], K=3 Left Rotate 1: 2,3,4,5,6,7,1 Left Rotate 2: 3,4,5,6,7,1,2 Left Rotate 3: 4,5,6,7,1,2,3 Solution: Reverse the…
Problem : Given of size ‘n’ and a values ‘k’ around which we need to right rotate the array. Array: [1,2,3,4,5,6,7], K = 3 Rorate1: 7,1,2,3,4,5,6 Rotate2: 6,7,1,2,3,4,5 Rotate3: 5,6,7,1,2,3,4 Solution…
This is one of the most common datastructure interview questions and to validate parenthesis. Examples of valid parentheses: (()){}{} Examples of Invalid parentheses : ({) or {(((()))) Problem: Given a…