Advertisement · 728 × 90
#
Hashtag
#collectionsinterviewquestions
Advertisement · 728 × 90
Preview
Top 11 Java ConcurrentHashMap Interview Questions with Answers [UPDATED] The ConcurrentHashMap class part of concurrent collections package added on JDK 1.5 which contains utility classes like BlockingQueue, CopyOnWriteArrayList, CopyOnWriteArraySet etc. It is a replacement of synchronized hash-based map implementations e.g. Hashtable and synchronized HashMap. It implements Map and ConcurrentMap (a sub-interface of Map) interface which allows you to store key-value pairs. The class is similar to HashMap or Hashtable but it's more scalable and the right fit for concurrent Java application. Unlike Hashtable which achieves its thread-safety by compromising the scalability, ConcurrentHashMap uses advanced techniques e.g. dividing the map into segments to remain thread-safe and scalable at the same time. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #HashMap #javacollectiontutorial

0 0 0 0
Preview
What is difference between Enumeration and Iterator in Java? Answer Though both Iterator and Enumeration allows you to traverse over elements of Collections in Java, there is some significant difference between them e.g. Iterator also allows you to remove elements from the collection during traversal but Enumeration doesn't allow that, it doesn't get remove() method. Enumeration is also a legacy class and not all Collection supports it e.g. Vector supports Enumeration but ArrayList doesn't. On the other hand, Iterator is the standard class for iteration and traversal. By the way,  what is the difference between Enumeration and Iterator in Java?  --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Difference between ArrayList and Vector in Java ArrayList and Vector are two of the most used classes on the java collection package and the difference between Vector and ArrayList is one of the most frequently asked java interview questions on first-round or phone interviews. Though it’s quite a simple question in my opinion but knowledge of when to use Vector over ArrayList or does matter if you are working on a project. In this article, we will some point-based differences between Vector and ArrayList in Java and trying to understand the concept behind those differences.  --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Difference between fail-safe vs fail-fast Iterator in Java? Example The difference between fail-safe and fail-fast Iterator is becoming favorite core java interview questions day by day, the reason it touches concurrency a bit, and the interviewee can go deep on it to ask how fail-safe or fail-fast behavior is implemented. In this article, we will see what are fail-safe and fail-fast iterators in java and the differences between fail-fast and fail-safe iterators. The concept of the fail-safe iterator is relatively new in Java and was first introduced with Concurrent Collections in Java 5 like ConcurrentHashMap and CopyOnWriteArrayList. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
How HashMap works in Java? Hello guys, if you are looking for an answer of popular Java interview question, how HashMap works in Java? or How HashMap works internally in Java then you have come to the right place. In this article, I will not just answer those question but also many related questions like How get() and put() method works in Java? what role equals() and hashcode() play in HashMap, How HashMap resize itself, and why key object of HashMap should be Immutable in Java. Let's start with the basics first. HashMap in Java works on hashing principles. It is a data structure that allows us to store object and retrieve it in constant time O(1) provided we know the key. Also this is one of my most popular article with more than 6 million views and I have now updated it to include latest information like how HashMap now uses a balanced tree instead of linked list for storing collision objects and new diagrams on HashMap working which provide visual explanations.  --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Difference between PriorityQueue and TreeSet in Java? Example The PriorityQueue and TreeSet collection classes have a lot of similarities e.g. both provide O(log(N)) time complexity for adding, removing, and searching elements, both are non-synchronized and you can get elements from both PriorityQueue and TreeSet in sorted order, but there is a fundamental difference between them, TreeSet is a Set and doesn't allow a duplicate element, while PriorityQueue is a queue and doesn't have such restriction. It can contain multiple elements with equal values and in that case head of the queue will be arbitrarily chosen from them. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #javacollectiontutorial

0 0 0 0
Preview
Difference between TreeSet, LinkedHashSet and HashSet in Java with Example TreeSet, LinkedHashSet, and HashSet all are implementation of the Set interface and by virtue of that, they follow the contract of Set interface i.e. they do not allow duplicate elements. Despite being from the same type of hierarchy,  there are a lot of differences between them; which is important to understand, so that you can choose the most appropriate Set implementation based upon your requirement. By the way difference between TreeSet and HashSet or LinkedHashSet is also one of the popular Java Collection interview questions, not as popular as Hashtable vs HashMap or ArrayList vs Vector but still appears in various Java interviews. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Difference between LinkedList and ArrayList in Java LinkedList and ArrayList both implement List Interface but how they work internally is where the differences lie. The main difference between ArrayList and LinkedList is that ArrayList is implemented using a resizable array while LinkedList is implemented using doubly LinkedList. ArrayList is more popular among Java programmers than LinkedList as there are few scenarios on which LinkedList is a suitable collection than ArrayList. In this article, we will see some differences between LinkedList and ArrayList and try to find out when and where to use LinkedList over ArrayList. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
What is difference between HashMap and Hashtable in Java? HashMap vs Hashtable in Java Though both Hashtable and HashMap are data-structure based upon hashing and implementation of Map interface, the main difference between them is that HashMap is not thread-safe but Hashtable is thread-safe. This means you cannot use HashMap in a multi-threaded Java application without external synchronization. Another difference is HashMap allows one null key and null values but Hashtable doesn't allow null key or values. Also, the thread-safety of the hash table is achieved using internal synchronization, which makes it slower than HashMap. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
What is difference between ArrayList and ArrayList in Java?- Raw Type vs Wildcard Example Tutorial One of my readers asked me about the difference between ArrayList vs ArrayList, which was actually asked to him in a recent Java development interview. The key difference between them is that ArrayList is not using Generics while ArrayList is a generic ArrayList but they look very similar. If a method accepts ArrayList or ArrayList as a parameter then it can accept any type of ArrayList like ArrayList of String, Integer, Date, or Object, but if you look closely you will find that one is raw type while the other is using an unbounded wildcard. What difference that could make? Well, that makes a significant difference because ArrayList with raw type is not type-safe but ArrayList with the unbounded wildcard is type-safe. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejavainterviewquestion

0 0 0 0
Preview
Difference between HashMap and IdentityHashMap in Java? Example Hello guys, if you are wondering what is differnece between an HashMap and IdentiyHashMap in Java then you are at right place. IdentityHashMap in Java was added in Java 1.4 but still, it's one of those lesser-known classes in Java. The main difference between IdentityHashMap and HashMap in Java is that IdentityHashMap is a special implementation of Map interface which doesn't use equals() and hashCode() method for comparing objects unlike other implementations of Map e.g. HashMap. Instead, IdentityHashMap uses the equality operator "=="  to compare keys and values in Java which makes it faster compared to HashMap and suitable where you need reference equality check and instead of logical equality. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
How to get Key From Value in Hashtable, HashMap in Java? Example It's not easy to get key from the value in Hashtable or HashMap, as compared to getting value from key because HashMap or Hashtable doesn't enforce one to one mapping between key and value inside Map in Java. in fact, Map allows the same value to be mapped to multiple keys inside HashMap, Hashtable, or any other Map implementation. What you have in your kitty is Hashtable.containsValue(String value) or Hashtable.containsKey(String key) to check whether key or value exists in HashMap or not, but sometimes we want to retrieve a value from Map corresponding to any key and there is no API method to do in Map. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Difference between HashMap, LinkedHashMap and TreeMap in Java with Example Hello guys, if you are wondering what is difference between HashMap, TreeMap, and LinkedHashMap in Java and when to use them then you are at the right place. In past, I have shared frequently asked HashMap Interview questions and ConcurrentHashMAp Interview questions and today, I Will answer this question in detail. The java.util.Map is one of the most important interfaces from the Java Collection Framework.  It provides hash table data structure functionality by its implementations like HashMap, Hashtable, LinkedHashMap, and a little bit of sorting with the TreeMap. So if you are looking to store key-value pairs in the Java program,  you have a wide range of choices available depending upon your requirement. The main difference between LinkedHashMap, TreeMap, and HashMap comes in their internal implementation and specific features, which a Java programmer should know to use them effectively.  --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejavainterviewquestion #HashMap

0 0 0 0
Difference between HashMap and HashSet in Java HashMap vs HashSet is the most frequently asked question during any core java interview and the interview is not said completed until they will not cover the Collection Framework and multi-threading interview and collections are uncompleted without Covering Hash Set and HashMap. Both HashMap and HashSet are part of the collection framework which allows us to work with a collection of objects. Collection Framework has its own interfaces and implementation classes. Basically, a collection is divided into Set Interface, List, and Queue Interfaces. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava

0 0 0 0
Preview
Enhanced For Loop Example and Puzzle in Java From Java 5 onwards, we have a for-each loop for iterating over collection and array in Java. For each loop allows you to traverse over collection without keeping track of index like traditional for loop, or calling hasNext() method in while loop using Iterator or ListIterator. For-each loop indeed simplified iteration over any Collection or array in Java, but not every Java programmer is aware of some useful details of the for-each loop, which we will see in this tutorial. Unlike other popular items from Java 5 release alias Generics, Autoboxing, and variable arguments, Java developers tend to use for-each loop more often than any other feature, but when asked about how does advanced foreach loop works or what is a basic requirement of using a Collection in the for-each loop, not everyone can answer. --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#collectionsinterviewquestions #corejava #javacollectiontutorial

0 0 0 0
Preview
Difference between a List and Array in Java? ArrayList vs Array Example Hello there, if you are wondering what is the difference between a list and an array, or particularly an ArrayList and an Array in Java then you have come to the right place. Earlier, I have shared the best data structure and algorithm courses and in this article, I will explain to you the differences and similarities between a list and an array in Java.  Both array and ArrayList are two important data structures in Java and frequently used in Java programs. Even though ArrayList is internally backed by an array, knowing the difference between an array and an ArrayList in Java is critical for becoming a good Java developer. If you know the similarity and differences, you can judiciously decide when to use an array over an ArrayList or vice-versa.  --- Java, Unix, Tibco RV and FIX Protocol Tutorial

#Array #ArrayList #collectionsinterviewquestions

0 0 0 0