Ads 970x90
Minggu, 07 November 2021
50+ Java Collections and Generics Interview Questions with Answers
Selasa, 02 November 2021
How to sort a Map by keys in Java 8 - Example Tutorial
Senin, 01 November 2021
How to use TreeSet in Java? SortedSet Example Tutorial
Hello friends, we meet again for our journey of learning Java. Today, we are gonna learn something very fruitful and easy. Hope you all are excited and ready. I would recommend you guys to go through the HashSet article which goes over hashing and what sets are actually as this topic has some of its features. So, What's the wait? Let's start! Continuing our example used in HashSet and reusing it here. Suppose you guys are given the task of storing car names (yes, I love cars :p). Now, how would you store it? This question has already been answered by our HashSet article. The new problem here is, we need to store the names in a naturally sorted manner. As we have a set of String, we need to sort them alphabetically. How to do that?
Senin, 18 Oktober 2021
Difference between Stack and Queue Data Structure in Java? Example
Rabu, 13 Oktober 2021
How to remove all elements (empty) from ArrayList in Java? Clear vs RemoveAll Example Tutorial
Sabtu, 31 Juli 2021
3 Ways to Convert an Array to ArrayList in Java? Example
Have you encountered any situation where you quickly wanted to convert your array to ArrayList or ArrayList to array in Java? I have faced many such situations that motivate me to write these quick Java tips about converting an array to ArrayList and ArrayList to array in Java. Both array and ArrayList are quite common and every Java developer is familiar with this. Former is used to store objects and primitive types while later can only hold objects. The array is part of standard Java fundamental data structure while ArrayList is part of the collection framework in Java.
Jumat, 30 Juli 2021
HashSet in Java – 10 Examples Programs Tutorial
Selasa, 27 Juli 2021
How to Find First and Last element in LinkedList Java? Doubly linked list Example
Difference between ConcurrentHashMap, Hashtable and Synchronized Map in Java
Though all three collection classes are thread-safe and can be used in multi-threaded, concurrent Java application, there is a significant difference between them, which arise from the fact that how they achieve their thread-safety. Hashtable is a legacy class from JDK 1.1 itself, which uses synchronized methods to achieve thread safety. All methods of Hashtable are synchronized which makes them quite slow due to contention if a number of thread increases. Synchronized Map is also not very different than Hashtable and provides similar performance in concurrent Java programs. The only difference between Hashtable and Synchronized Map is that later is not a legacy and you can wrap any Map to create it's synchronized version by using Collections.synchronizedMap() method.