Quartz scheduler components

Quartz job: Quartz job is used for the logic or code which you want to execute. It implements org.quartz.Job interface. Quartz trigger: Quartz trigger is used to define the moment when the quartz scheduler will execute quartz’s job. Types of quartz trigger: 1. SimpleTrigger – SimpleTrigger setting start time, end time, repeat count and repeat … Read more

ListIterator interface in java

ListIterator: ListIterator interface is used to traverse the elements in both forward and backward directions. Note: Can traverse elements in both forward and backward directions. Commonly Used methods of ListIterator Interface: 1. hasNext(): Returns true if iterator has more elements in forward direction otherwise returns false. Syntax: public boolean hasNext(). 2. next(): Returns the element … Read more

Hashtable in java

Java Hashtable: Hashtable extends Dictionary class and implements Map interface. It contains elements in key-value pairs. It is not allowed duplicate keys. It is synchronized. It can’t contain a null key or value. It uses the hashcode() method for finding the position of the elements. Note: It is an array of a list. Each list … Read more

Properties class in java

Properties class: Properties class is used to maintain the data in the key-value form. It takes both key and value as a string. Properties class is a subclass of Hashtable. It provides the methods to store properties in a properties file and to get the properties from the properties file. System.getProperties() returns the all system … Read more

Comparator interface in java

Comparator interface: Comparator interface is defined in java.util package. It has two methods named compare(Object obj1,Object obj2) and equals(Object element). Note: In the case of the Comparator interface, we can sort the elements based on multiple properties. Suppose we have Student class elements with name, class, and rollNo as properties then by using the Comparator interface we can … Read more

Comparable interface in java

Comparable interface: Comparable interface is defined in java.lang package. It has only one method namedcompareTo(Object o). It is used to implement the natural ordering of collection elements. String and wrapper classes implement Comparable interface. Note: In the case of Comparable Interface, we can sort the elements based on a single property only. Suppose we have Student class elements with name, class, … Read more

Sorting in collection framework

Sorting: Sorting is a process of arranging data in an increasing or decreasing order. The elements of the String objects, the Wrapper class objects, and the User-defined class objects can be sorted. For sorting the elements of a collection, static methods are provided by the Collections class. As we discussed earlier that TreeSet and TreeMap … Read more

ArrayDeque in java

ArrayDeque: ArrayDeque extends AbstractCollection and implements Deque. ArrayDeque are not thread safe. It not allows the null elements.  Note: ArrayDeque are faster than Stack and LinkedList.  ArrayDeque example: ArrayDequeTest.java import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator;   /** * This class is used to show the ArrayDeque functionality. * @author w3schools */ public class ArrayDequeTest { … Read more

PriorityQueue in java

Queue Interface To order the element, the Java Queue interface uses FIFO(First In First Out) method, i.e., the first element is removed first and the last element is removed at last. Queue Interface declaration: public interface Queue<E> extends Collection<E> Queue Interface Methods: Method Description boolean add(object) It will insert the specified element into this queue and … Read more

Abstract classes in collection framework

1. AbstractCollection: AbstractCollection implements most of the Collection interface. 2. AbstractList:   AbstractList extends AbstractCollection and implements most of the List interface. 3. AbstractSequentialList: AbstractSequentialList extends AbstractList for use by a collection that uses sequential rather than random access of its elements. 4. AbstractSet: AbstractSet extends AbstractCollection and implements most of the Set interface. 5. … Read more