Wednesday, January 17, 2018

Java flatMap with example

In this post you will learn what is flatMap in Java8 and where we used flatMap. flatMap is a intermediate operation,which returns a new stream. Intermediate operations are classified as stateless and stateful operations based on need for sharing the information between elements while processing.

As per the Javadoc......

public <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)

Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. Each mapped stream is closed after its contents have been placed into this stream. (If a mapped stream is null an empty stream is used, instead.) This is an intermediate operation.

The following example understand you how to use flatMap in java8.The same example if you write before java 8 then you could write multiple loops. But in Java 8 it could be like this

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class FlatMapExample {
public static void main(String args[]) {
List<Zoo> zooList = new ArrayList<>();
Zoo nationalZoo = new Zoo("National");

        Zoo aCountyZoo = new Zoo("Wills County");


        // to get the aggregate
 List<String> animalList =
                .flatMap(element -> element.getAnimals().stream())

        // to get the unique set
Set<String> animalSet =
                .flatMap(element -> element.getAnimals().stream())
class Zoo {
private String zooName;
private Set<String> animals;
public Zoo(String zooName) {
this.zooName = zooName;
this.animals = new HashSet<>();
public void add(String animal) {
public Set<String> getAnimals() {
return animals;

[Peacock, Lion, Tiger, Gorilla, Peacock, Camelion]
[Peacock, Lion, Tiger, Gorilla, Camelion]

Imagine that you want to create the following sequence: 1, 2, 2, 3, 3, 3, 4, 4, 4, 4 etc. (in other words: 1x1, 2x2, 3x3 etc.)

With flatMap it could look like:

IntStream sequence = IntStream.rangeClosed(1, 4)
                          .flatMap(i -> IntStream.iterate(i, identity()).limit(i));


IntStream.rangeClosed(1, 4) creates a stream of int from 1 to 4, inclusive
IntStream.iterate(i, identity()).limit(i) creates a stream of length i of int i - so applied to i = 4 it creates a stream: 4, 4, 4, 4
flatMap "flattens" the stream and "concatenates" it to the original stream

With Java < 8 you would need two nested loops:

List<Integer> list = new ArrayList<>();
for (int i = 1; i <= 4; i++) {
    for (int j = 0; j < i; j++) {

Monday, December 18, 2017


In this post we will learn Secret Codes for Android Mobile,These are very useful to get any information of the mobile phone. We  are  revealing  the  secrets  of android  mobiles. There  are  some  of  the secret  codes  which  are  used  for  the users to access the  information  of  the  mobile phones.  To  know  the  details  like :- IMEI, RAM, FTA SW VERSION, FTA HW VERSION, TOUCH SCREEN VERSION..........etc...,

Image result for android

The following codes are given below:

          To display  IMEI  number                                    :        *#06#
  1. To display RAM memory version                      :         *#*#3264#*#*
  2. To display FTA SW version                                :         *#*#1111#*#*
  3. To display FTA HW version                               :         *#*#2222#*#*
  4. To test touch screen                                             :         *#*#2663#*#*
  5. LCD display test                                                  :         *#*#0*#*#*
  6. To AUDIO test                                                     :         *#*#0289#*#*
  7. To test bluetooth                                                  :         *#*232331#*#
  8. To display bluetooth address                              :         #*#232337#*#
  9. To test secret GPS                                                :         *#*#1472365#*#*
  10. To test other gps                                                   :          *#*#1575#*#*
  11. Tto test wifi                                                           :         *#*#232339#*#*
  12. To display WIFI MAC address                           :         *#*#232338#*#*
  13. To test vibration and back light of the phone    :         *#*#0842#*#*
  14. To test proximity/distance sensor                        :         *#*#0588#*#*
  15. For audio test                                                        :         *#*#0289#*#*
  16. To launch service mode                                        :         *#*#197328640#*#*
  17. Hidden servicemenu (moto)                                 :         ##7764726
  18. Field test                                                                 :        *#*#7262626#*#*
  19. To format the phone                                              :        *2767*3855#
  20. To restore factory setting                                      :        *#*#7780#*#*
  21. To create immediate backup to your multimedia files: *#*#273282*255*663282*3*#*
  22. To display phone information                               :        *#*#4636#*#*
  23. To display camers information                             :        *#*#34971539#*#*
  24. View lock status                                                      :        *#7465625#
  25. Changing behavior of the power button              :        *#*#7594#*#*

Saturday, November 25, 2017

what are the most trending jobs in the IT Industry in 2017

In this post we will know what are the best jobs in the IT industry right now. Currently most product based industries are in search for candidates who are able to write the correct logic for a program which is what the recruiters are looking for today.

The web development and Data Science are currently trending job roles which are hot in the market right now. To get best job roles one must start acquiring these skills to do so.

  • Web Development
  • Data Science
  • Artificial Intelligence and Machine Learning Developer
  • Blockchain Dev
  • Cloud Software Engineering
Web Development:

To get into web development one must know the skills of technologies such as Angular.js,Javascript,JSON,Node.js,MongoDB and Cloud etc.. The basic job roles that one gets offered after acquiring these skills are Front-end developer,Back-end developer, Full stack developer. An average pay a developer gets offered ranges from around 5 to 6 lpa in a product based company.

Data Science:

In spite of increased availability of highly refi ned data collection tools and analytics dashboards, there is still high demand for data scientists since they possess advanced skillsets in statistics and analytics, which is needed to clean and organise data before extracting valuable insights. 

The skills required mathmatics,statistics,R, Python Programming,Machine Learning,Data Modeling and Algorithms etc.. An average salary a Data Scientist gets offered ranges from 6 to 7 lpa as a fresher in product based company.

Who is hiring:

Social Networks, e commerce,Mobile Marketing, Search engines and engineering companies

Artificial Intelligence:

Being an artificial intelligence and machine-learning developer compels understanding of the entire ecosystem that you’re designing for. This necessitates working with AI and machine components that run autonomously with minimal human supervision. An average salary a AI developer gets offered ranges from 10 to 12 lpa  in product based company.

Who is hiring:

Technology Companies, health care and customer services

Blockchain Dev:

Blockchain developers enable transparent, tamper-proof systems that facilitate transactions between machines without going through a neutral central authority. With a steady rise of interest in the technology, there is an increased demand for adoption at multiple stages of blockchain, which impacts the skill requirement.An average salary a Blockchain developer gets offered ranges from 4 to 5 lpa  in product based company.

Who is hiring:

Media, telecommunications, health care,technology companies and financial industry

 Cloud Computing Engineering:

The demand is expected to rise exponentially because more and more companies are implementing cloud technology and this is a crucial role in the loud computing ecosystem.An average salary a Cloud Computing developer gets offered ranges from 6 to 7 lpa  in product based company.

Who is hiring:

Tech Manufacturing, pharma,media,retail,software and telecom

In order to acquire these skills go to best websites such as Udemy, simplelearn and Edureka. They offer you different courses and certifications on the technologies so that you can acquire skills in the web development and data science etc..

Sunday, November 19, 2017

HR Interview Questions for Experienced Candidates

In this post we will know some of the frequently asked HR Interview Questions for Experienced Candidates.HR interviews are usually tough as HR managers ask tricky interview questions for HR positions to save time and to figure out what kind of employee you really are, especially if you are applying for a position in the HR department. A  few HR interview questions and answers about your job role or career and in the end, discuss salary, perks, benefits, deductions, company rules and regulations, conditions etc. with the HR person.

1) Can you speak more about Yourself?

Ans: This is the question most commonly asked in any interview. Since, HR could ask more questions based on your answer. In fact,this question is an opportunity to emphasize the points that you most want this potential employer to know about you. You can include details like education background,father profession and some other information about your achievements and hobbies along with project. You can also wrap up your answer by indicating why you are looking for a new challenge and why you feel this role is the best nest step.

2) Since a long time you seem to be working with the same company. Why?

Ans: Discuss about some different kinds of assignments you got from your company and how you handled and their importance to the company.Company sometime consider this as a lack of ambition in the candidate.

3)Why do you want leave your present Job?

Ans: You could say something like, over last 6 months  a lot of restructuring was going on in the company and few of the positions became surplus. One of them was mine but i have learnt a lot during my tenure at ABC company and i am sure i can add a lot of values to a position. You can also tell, after providing dedicated services to my current employer,it's the right time to widen my horizons and prove myself capable of accepting a new challenge.But, make sure that better prospects means in in terms of experience, and exposure.

4)Suppose, you are recruiting someone for this position. So, what qualities would you look for?

Ans: Before appearing for the interview, make sure that you have already analyzed the job requirements because this is the time to estimate your understanding of the position. Focus on the skills, qualities and experience you would look for in a person for this position.

5)Why should i hire you from the outside when i could promote someone from within?

Ans: You could answer like yeah, you are right to promote someone from your organization. But sometimes give opportunity to outsider. Since, your employees can see only present aspect and routine thoughts,but as a outsider,we can see various aspects with fresh thoughts and ideas that would helps a lot.

6)May i contact your present employer for any reference?

Ans: Yes, of course. I can provide you all required references and details.

7) Would you like to work in a team or own self?

Ans: Interviewer wants to know whether you are a team player or independent work. Sometimes, you need to work in a team and sometimes independently. A good answer for this question can be “I can adjust myself in team project as well as I can handle independently”.

8)Did you think of changing your present job earlier? Why didn’t you change on that time?

Ans: Try to memorize the reason why you wanted to change earlier and what made you to continue like any type of flexibility or advancement opportunities etc.

9) If your team does not perform well then what will you do?

Ans: You need to understand the management carefully. First you need to find the reason for non-performance then eradicate them.

10)What is your expected salary?

Ans: Don’t mention the actual figure. Try to mention a range like “I should be comfortable with something in the range of mid forties fr example”. Try to ask them what type of salary the company offers for that particular position.

11) What if some other company offered you with a salary higher than this. So, will you change for better opportunity?

Ans: In this type of questions interviewer try to analyze whether you would change for a couple of thousands. You can discuss this issue with your senior and in teams of growth in the present job you need to stick otherwise move to the next decision.

12)What are your career Goals?

Ans: After providing dedicated service to my current employer, I am ready to accept new challenge if given the opportunity. I should be hired based upon my attributes of being a top performer,confidence level,adaptability and never say die attitude.

13) if you are  facing a problem with your own performance. How do you handle this situation?

Ans: Interviewer looks for those candidate if someone face any problems then how they can handle this. Analyze them how you are trapped into a problem and how you solve this type situation.

Wednesday, November 8, 2017

Difference Between SQL and NoSQL database

SQL databases are a Relational Database( RDBMS) whereas NoSQL databases are distributed databases. This means they are easier to manage and they provide a higher level of flexibility with newer data models.Sql database represent data in the form of table means it represent data in row and coloumns whereas Nosql database represents data in documents means it collects data in key value pairs. SQL databases are vertically scalable whereas NoSQL databases are horizenatlly scalable.And another main difference is that the amount of data stored mainly depends on the Physical memory of the system. While in the NoSQL you don't have any such limits as you can scale the system horizontally.

Extremely large datasets are often event based transactions that occur in chronological order. Examples are weblogs, shopping transactions, manufacturing data from assembly line devices, scientific data collections, etc. These types of data accumulate in large numbers every second and can take a RDBMS with all of its overhead to its knees. But for OLTP processing, nothing beats the combination of data quality and performance of a well designed RDBMS."
NoSQL is a very broad term and typically is referred to as meaning "Not Only SQL." The term is dropping out of favor in the non-RDBMS community.
You'll find that NoSQL database have few common characteristics. They can be roughly divided into a few categories:

key/value stores
Bigtable inspired databases 
Dynamo inspired databases
distributed databases
document databases

  • By nature, relational databases are the go-to solution for complex querying and data keeping needs. They are much more efficient and excel in this domain.

  • When it comes to data reliability and safe guarantee of performed transactions, SQL databases are still the better bet.

  • SQL examples are MySql etc whereas Nosql examples are MongoDB, BigTable etc.

But SQL guarantees data integrity. NoSQL allows freedom in how you store data (you are not limited to storing one item in one field like in SQL. Think of SQL as an excel sheet and NoSQL as a notepad file. You are free to store your data as you want). So its easier to make mistakes in NoSQL and you could actually loose the advantage of the control you get by following wrong practices.