Collections interface

Arrays Class in Java – Free Java Tutorials and Online Training

Arrays Class is a utility class to define several utility methods for Arrays or Arrays objects. Here we discuss about the Arrays Class methods. Sorting elements of Array Arrays Class defines the following sort methods to sort elements of Primitive and Object type Arrays: public static void sort(primitive[] p): This method is used to sort elements …

Arrays Class in Java – Free Java Tutorials and Online Training Read More »

Multi Threading in Java : Free Java Tutorials and Online Training

Multitasking – The objective of multitasking is to execute multiple tasks simultaneously to reduce CPU response time and make program execution faster and improve overall system performance. In Java we have multi processing and multi threading. It can be achieved in two ways: 1) Process-based Multitasking (multi-processing) In multi-processing, each task that is being concurrently executed …

Multi Threading in Java : Free Java Tutorials and Online Training Read More »

LinkedHashMap, IdentityHashMap and WeakHashMap : Free Java Tutorials

LinkedHashMap LinkedHashMap is the child class of HashMap. It is exactly same as HashMap (including methods and constructors) except the following   differences: LinkedHashSet and LinkedHashMap are commonly used for developing cache based applications. Let us take a programming example of LinkedHashMap : import java.util.*; class LinkedHashDemo { public static void main(String args[]) { LinkedHashMap lh …

LinkedHashMap, IdentityHashMap and WeakHashMap : Free Java Tutorials Read More »

Comparable and Comparator Difference : Free Java Tutorials

For predefined comparable classes (String) default natural sorting order already available. If we are not satisfied with that default natural sorting order, then we can define our own sorting by using Comparator Interface. For predefined non comparable classes StringBuffer default natural sorting order not already available, we can define our own sorting technique by using …

Comparable and Comparator Difference : Free Java Tutorials Read More »

String Objects in TreeSet – Free Java Tutorials and online Training

Let us take some programming examples based on String objects in TreeSet concept : Example1 : Write a JAVA Program to insert String Objects into a TreeSet where all elements should be inserted according to reverse of alphabetical order. import java.util.*; class myComp implements Comparator // Our custom comparator class { public int compare(Object obj1, Object …

String Objects in TreeSet – Free Java Tutorials and online Training Read More »