Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
How to Convert a Comma Separated String to an ArrayList in Java - Example Tutorial
How to create and initialize List or ArrayList in one line in Java? Example
How to Order and Sort Objects in Java? Comparator and Comparable Example
ArrayList vs Vector in Java? Interview Question Answer
ArrayList and Vector are the two most widely used Collection classes in Java and are used to store objects in an ordered fashion. Every Java programmer which is introduced to Java Collection Framework either started with Vector or ArrayList. For beginners Difference between Vector and ArrayList in Java and LinkedList vs ArrayList are the two most popular Java Interview questions. ArrayList vs Vector is not only important from an interview perspective but also on the effective use of Java Collection API.
How to Search an Element in Java Array with Example? ArrayUtils Tutorial
How to use Deque Data Structure in Java? Example Tutorial
Java ArrayList Tutorials and Examples for Beginners (with Java ArrayList Cheat Sheet)
10 Examples of Comparator, Comparable, and Sorting in Java 8
Hello guys, the Comparator class is used to provide code or logic for comparing objects in Java, while sorting a list of objects or a collection of objects. It's close cousin of Comparable which provides natural order sorting e.g. ascending and descending orders for numbers like int, short, long or float, and lexicographic order for String i.e. the order on which words are arranged in dictionaries. The Comparators are used while sorting arrays, lists and collections. You pass logic to compare objects and sorting methods like Collections.sort() use that logic to compare elements until they are arranged in sorted order.
How to shuffle a List in Java? Collections.shuffle() Example
Difference between HashSet and HashMap in Java? Answered
Hello friends, if you have given Java developer interview then there is good chance that you may have come across questions like Difference between HashSet vs HashMap or HashSet vs TreeSet etc. In this article, we are going to discuss differnece between HashMap and HashSet, two of the popular Collection classes from JDK. The HashSet vs HashMap is a classical Java Collection interview question that focuses on What are differences between HashSet and HashMap in terms of features, usage, and performance. If you are in Java programming even for a year or so, you are likely to be familiar with What is HashSet in Java and What is HashMap in Java, these two are the most popular collection classes.
How to sort ArrayList in Java? Examples
How to replace an element of ArrayList in Java? Example
Difference between ArrayList and HashSet in Java? Answer with Example
Difference between Queue and Deque in Java? Example Tutorial
Hello guys, today I am going to share another interesting question from Java interview, what is difference between Queue and Deque in Java. This question was asked to one of my reader in a recent interview with JP Morgan Mumbai and this is also a popular Java collection interview question. While he was able to answer the question, he wasn't able to convince interviewer so he asked me how to answer this question. So I am writing this post to share my answer on Queue vs Deque in Java. In the vast world of Java programming, the need to manage data efficiently often leads developers to specialized data structures.
How to find length/size of ArrayList in Java? Example
How to remove all elements of ArrayList in Java - RemoveAll Example
How to loop over a TreeSet in Java with Example
How to Convert Vector to Array in Java? 2 Examples
How to sort a LinkedList in Java? Example Tutorial
10 Example of List in Java
Hello guys, Java, as a versatile and widely used programming language, offers a plethora of data structures to developers. One of them is List which is also fundamental component in Java's collection framework, play a pivotal role in managing and manipulating sequences of elements. In the past, I have shared 10 Examples of HashMap in Java and In this article, we'll delve into Java lists, exploring their features and providing ten illustrative examples to deepen your understanding. List are also a popular topic from Java interviews with questions like difference between ArrayList and LinkedList which have been asked to me almost 10 times in past 20 years.