Interfaces went through major changes while redesign in Java 8 and as a part of that Java 8 default methods in Interface are the major addition. Java 8 interfaces also supports static methods along with default and abstract methods. Let’s dig into the more details to know the facts about default methods in interfaces.
Whenever we hear about Java 8 Streams the first thing which strike in mind would be Java I/O stream and classes like
OutputStream. But here in Java 8 Stream is quite different concept than Java I/O Streams. Java 8 Stream best implementation of functional programming which can be used easily with Java Collection Framework.
Java 8 Functional Interface concept was introduced by Java to support Lambda Expressions which are very similar to Scala with the fact that you can assign Lambda Expression to a Functional Interface. Let’s explore the details.
Before we move ahead lets learn a bit on Setup Apache Spark,
So, What is Apache Spark?
Apache Spark is a fast, real time and extremely expressive computing system which executes job in distributed (clustered) environment.
It is quite compatible with Apache Hadoop and more almost 10x faster than Hadoop MapReduce on Disk Computing and 100x faster using in memory computations. It provides rich APIs in Java, Scala and Python along with Functional Programming capabilities.
Many of us are very curious about the fact that why functional references introduced in Java 8 are know as Lambda Expressions. So let’s reveal the fact of word “Lambda Expressions” and make it very simple to understand.
This fact is very much related to the Evaluation process of any expression. Many of us may have solved the mathematical problems and while solving the problems we may have observed how we are reducing the mathematical expression to some values. Similarly we also may have observed in many programming languages how any expression is evaluated.
Java 8 is completing almost 2 years now and this topic is widely discussed on Internet now a days. Java was originally designed to work OOP as it was the primary paradigm for software development at that time. But today’s programming directed towards concurrent and reactive programming which focuses on functional modularity which is provided by functional languages like Scala.
Concept of functional programming is completely a new era for the hard core Java Programmers and lambda expressions are bridging OOP and FP by adding functional language capabilities to Java. You will find this concept roaming around anonymous classes and functional programming.
For many of us term Syntactic Sugar could be something out of this world and the term is too much heavy that anyone would wonder about this alien word. But many times the concept behind such terms is very simple. Now let’s make this word easily understandable. In such cases, I always split the term into separate words and try to understand the meanings of individual words in programming world prior to understand actual meaning the term.
Before we understand practical capacities of Scala language or attempt to learn core ideas of lambda expressions in Java, it is more crucial to understand the concept of Functional Programming first.
Most of the popular programming languages (like C, C++ and Java) are primarily created to follow the methodology of Imperative Programming, which implies that programmer generally write a code block (sequence of statements) which will change the state of the program(value of the variables) as each line is executed step by step.
Installing Java on CentOS is one of the easiest exercise ever. However, I’ll let you know two different ways in which Java can be installed on CentOS. We’ll take latest version of Java which is Java 8. Even you can combine all following steps in one shell script and can simply execute that shell script in order to install Java/JDK. Following steps are performed using root user you can also execute the steps with non root user having sudoer rights. Before moving towards installation process I have assumed that CentOS has
wget command installed. If not than install it using below step.