Monday, 12 December 2016

Java all Part II

Why we can't do subtyping in generics?

Why generics array can't be created?


What are the new features in Java 8?
-foreach,spliterator in interable interface

What is Spliterator?

What is Consumer interface?

What is Predicate interface?

What is functional interface?
An interface with exactly one abstract method becomes Functional Interface.

What is the use of functional interface?
It's greate to use it in lambda expressions.

What are Single Abstract Method interfaces(SAM)?

default vs static in interface?
We can't override static. static is indeed static, it isn't inherited, can be used directly with Interface name. So, now interface can contain static methods.

What is the use of @FunctionalInterface annotation?
We don’t need to use @FunctionalInterface annotation to mark an interface as Functional Interface. @FunctionalInterface annotation is a facility to avoid accidental addition of abstract methods in the functional interfaces. You can think of it like @Override annotation and it’s best practice to use it. 

What is map reduce?
map function transforms input like doubling each value, reduce function convert list to some value like average,sum,etc.

What new methods have been added to Collection iterface?

What new methods have been added to Iterable interface?


What new methods have been added to Map interface?

Stream vs parallel stream?

flatMap?
Flatten a stream of list of stream.


Jdbc in java8

What is jdbc-odbc bridge, why is it removed in Java8?
http://stackoverflow.com/questions/14229072/removal-of-jdbc-odbc-bridge-in-java-8


Benefits of lambda expressions?

Method reference?

Constructor reference?

Repeated annotation?

Optional?















No comments:

Post a Comment