Java 8 – Functional Interfaces

java-thumbnail

What are Functional Interfaces? Functional interfaces are those interfaces that has single abstract method. According to Java 8 Specification, interface can be known as functional interface if there is a single method that is compliant with the below rules: If an interface has single abstract method, then it is known as the functional interface. A functional interface can have any […]

TreeMap Class Example

java-thumbnail

The TreeMap class creates maps stored in a tree structure. It stores the key/ value pairs in a sorted order efficiently. The TreeMap class extends AbstractMap and implements the NavigableMap interface. It is a red-black tree based implementation. TreeMap is a sorted order collection, which is sorted according to the natural key or by providing […]

Java InvalidPropertiesFormatException Example

java-thumbnail

When we are using the collection of properties, if the input does not conform to the valid XML document type with the appropriate properties specification at that time an exception is thrown called InvalidPropertiesFormatException, to indicate operation could not be completed. This example explains about that exception. Java InvalidPropertiesFormatException Class Declaration In the above declaration, […]

Java Currency Class Example

java-thumbnail

The currency class presents a currency method. The currency codes ISO 4217(International Organisation for standardization) is been identified for currency. This class presents all worldwide currencies. There is no public constructor as it is designed for only one currency instance at a time and not more than one. The # is used to begin the […]

Java Date Class Example

java-thumbnail

The class Date is nothing but the representation of the specific instant in Time. It is given in the millisecond precision. For calculation purpose, all the operating system assumes that 1 day= 24*60*60=86400 seconds. However, in Coordinated Universal Time (UTC), there is an extra second called “leap second” about once every year or two year […]

Java Arrays Example

java-thumbnail

An Array is a data structure which represents a group of elements of same data type. It can store a group of elements either it may be variable or objects. We can define the length of the array, when the array is created. We cannot store some integer values and some string values together in […]

Java Stack Class Example

java-thumbnail

Stack is the subclass of Vector which is dynamic in nature and its size goes on increasing as the elements are added to it. Stack class allows creating the pile of the elements where, last element added to the stack is taken out first. This is also referred to as “Last in First Out” (LIFO). […]

Java SimpleTimeZone Class Example

java-thumbnail

SimpleTimeZone is a subclass of TimeZone which is defined as standard time followed within a geographical area for the use with the Gregorian calendar. SimpleTimeZone class extends the Super Class TimeZone. This class takes an offset from GMT, also known as raw offset to set the start and end rules for the Daylight Saving Time. […]

Java TimeZone Class Example

java-thumbnail

TimeZone is an abstract class which defines as standard time followed within a geographical area for the use with the Gregorian calendar. The TimeZone class allows working with TimeZone offset based on Greenwich Mean Time (GMT) which is referred as Coordinated Universal Time. It also sets a daylight saving time. By using getDefault TimeZone, it […]

Java PriorityQueue Class Example

java-thumbnail

In the PriorityQueue, elements are ordered in accordance to their natural ordering or the order defined by the Comparator. Comparator is the factor which compares the elements for the ordering purpose. These are defined at the queue construction time which decides the ordering of elements in the queue, based on the type of constructor used. […]