There has been lot of discussion on how a Software application should be developd.
What should be the Architecture?
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
Thursday, 10 December 2015
Saturday, 5 September 2015
Java Developer 4 to 6 yrs exp Interview at Cognizant
Following were the questions which are asked to my colleagues at experience of 4 to 6 years.
- Tell me about your current project ?
- What were your roles and responsibilities in your project?
- Can you draw architecture diagram of your project?
Labels:
Collection,
Exception Handling,
Interview,
Java,
Java Developer
Location:
SB Road, Pune, Maharashtra, India
Friday, 3 July 2015
Custom Java HashMap - Internal Working
HashMap is a Collection class in Java that stores objects with the help of hascode and equals. It is said to be faster in retrieving objects.
Lets create a custom implementation of HashMap and understand how it works. To understand HashMap you need to first understand Singly and DoublyLinkedList.
HashMap stores objects in form of Key and Value. A value can be fetched by passing the Key.
HashMap stores objects into different buckets(LinkedList). The object with same hashcode are stored in same LinkedList. Remember that the objects are stored in key-value pairs. The hashcode of key is used and not the hashcode of value. Only Key alone is required to put and get the object. Value is just a object placed against the key, So depending upon how many objects(Keys) are present with different hashcodes, that many LinkedList gets created.
Lets create a custom implementation of HashMap and understand how it works. To understand HashMap you need to first understand Singly and DoublyLinkedList.
HashMap stores objects in form of Key and Value. A value can be fetched by passing the Key.
HashMap stores objects into different buckets(LinkedList). The object with same hashcode are stored in same LinkedList. Remember that the objects are stored in key-value pairs. The hashcode of key is used and not the hashcode of value. Only Key alone is required to put and get the object. Value is just a object placed against the key, So depending upon how many objects(Keys) are present with different hashcodes, that many LinkedList gets created.
Monday, 1 June 2015
Java Singleton Pattern
Singleton pattern is the most common types of patterns used in Java. It is also very common that interviewers ask questions to explain and implement singleton pattern
Lets first define Singleton
Singleton is a class whose only one object can be created.
There are couple of ways to implement Singleton class. Lets see the simplest one first.
Lets first define Singleton
Singleton is a class whose only one object can be created.
There are couple of ways to implement Singleton class. Lets see the simplest one first.
Tuesday, 27 August 2013
Java Collections : Internal Working
Java Collections:
Going for an Job Interview? be prepared with Java Collections framework. Java Collection framework is the most preferred topic by interviewers. It gives them the idea of how much effort the interviewee as taken to understand this framework and clear the interview.
And guess what, similar questions are now also asked in US for H1B visa holders, or MS post graduates looking for job.
This blog explains internal working of the Collection framework. For Interview Question on Collection refer Java Collection Interview Questions.
For Java Interview questions for 2 to 5 years Senior Developer refer this blog.
Recently Blockchain has also made place in Java Interviews. Blockchain internally is also a Data Structure. To know more click here : Implementing Blockchain using Java
Click Here for Core Java Objective Questions and Answers
Custom implementation of Collections and Data Structure:
Java Collection internally uses the primitive and core elements like Arrays and datastructures like Linked List, Tree etc. So if you are asked a question to explain the internal working of any of the Collection classes, don't be surprised. Be it an interview for an Junior Java developer or even for an Architect, Java Collection is always something that you will have on you plate.
Java provides many collection classes that can be used to store data. Knowing which collection class to use for best performance and optimum result is the key.
First the basics.
Below two image shows the complete hierarchy of interfaces and classes present in the Collection framework.
The Collections come in basic four flavors:
Lists : List of things ( Classes that implement List Interface)
Sets : Unique things ( Classes that implement Set Interface)
Maps : Things with unique id ( Classes that implement Map Interface)
Queues : Things arranged in order ( Classes that implement Queue Interface)
The blue ones are the Interfaces and the red ones are the implementation classes
Below is Map. A map is a special type of collection.
And guess what, similar questions are now also asked in US for H1B visa holders, or MS post graduates looking for job.
This blog explains internal working of the Collection framework. For Interview Question on Collection refer Java Collection Interview Questions.
For Java Interview questions for 2 to 5 years Senior Developer refer this blog.
Recently Blockchain has also made place in Java Interviews. Blockchain internally is also a Data Structure. To know more click here : Implementing Blockchain using Java
Click Here for Core Java Objective Questions and Answers
Custom implementation of Collections and Data Structure:
Internal Working of Arraylist
Internal Working of LinkedList
Internal Working of HashMap
Internal Working of TreeMap
Internal Working of LinkedList
Internal Working of HashMap
Internal Working of TreeMap
Java Collection internally uses the primitive and core elements like Arrays and datastructures like Linked List, Tree etc. So if you are asked a question to explain the internal working of any of the Collection classes, don't be surprised. Be it an interview for an Junior Java developer or even for an Architect, Java Collection is always something that you will have on you plate.
Java provides many collection classes that can be used to store data. Knowing which collection class to use for best performance and optimum result is the key.
First the basics.
Below two image shows the complete hierarchy of interfaces and classes present in the Collection framework.
Lists : List of things ( Classes that implement List Interface)
Sets : Unique things ( Classes that implement Set Interface)
Maps : Things with unique id ( Classes that implement Map Interface)
Queues : Things arranged in order ( Classes that implement Queue Interface)
The blue ones are the Interfaces and the red ones are the implementation classes
Below is Map. A map is a special type of collection.
Below table shows the different concrete classes implementing these interfaces
Maps
|
Sets
|
Lists
|
Queues
|
Utilities
|
|---|---|---|---|---|
HashMap
|
HashSet
|
PriorityQueue
|
Collections
| |
Hashtable
|
LinkedHashSet
|
Vector
|
Arrays
| |
TreeMap
|
TreeSet
|
LinkedList
| ||
LinkedHashMap
|
Monday, 26 August 2013
Data Structure : Binary Search Tree
This blog describes the Internal Working of TreeMap. This is a Binary Search Tree. Similar to java.util.TreeMap.
Binary Search Tree (BST) is a Data Structure which places the data in sorted order. Each Node has 2 pointers/references left and right. If the data to be inserted is smaller than the current node than the new node is attached at the left of the current node. If the data to be inserted is greater than the current node than the new node is attached at the right of the current node.
Binary Search Tree (BST) is a Data Structure which places the data in sorted order. Each Node has 2 pointers/references left and right. If the data to be inserted is smaller than the current node than the new node is attached at the left of the current node. If the data to be inserted is greater than the current node than the new node is attached at the right of the current node.
Subscribe to:
Posts (Atom)
Share the post
|
|
|
