Tumgik
blocks2code · 1 year
Text
Map Interface in Java With Program Example
The Map interface is part of Collection framework, however, it is not a sub-interface of the collection. It deals with and represents a group of objects in key-value pair. In this, keys and values are objects where keys must be unique and values can be duplicated. Each key-value pair is termed as Entry and a set of such entries is known as Map. It can be defined as an interface that empowers to…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
TreeSet Class in Java With Program Example
TreeSet is an implementation class of NavigableSet interface which is a child interface of SortedSet. It is a class in the collection framework that stores and manipulates elements in some sorting order. It represents self-balancing binary tree as its underlying data structure which makes it a good choice for search and retrieving operations. Syntax: Set<T> set = new TreeSet<T>(); It stores…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
LinkedHashSet Class in Java With Program Example
LinkedHashet is an implementation class of the Set interface which also extends the HashSet class. It was introduced in Java 1.4 version. It behaves in the same manner as HashSet except that it preserves or maintains the insertion order of elements inserted in the set. In simple words, It is an implementation of the set interface that stores and manipulates an ordered collection of elements. It…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
HashSet Class in Java With Program Example
Set interface doesn’t provide any additional method, as a result, implementation classes use only collection interface methods. HashSet is an implementing class of Set interface and it represents Hash Table as its underlying data structure. It is a collection of unordered unique elements that don’t allow duplicates. It also doesn’t preserve insertion order as it uses hash code to store an…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
NavigableSet Interface in Java With Program Example
NavigableSet is a child interface of SortedSet that provides navigation methods to navigate through a set. It showcases the same behaviour as SortedSet with some additional navigable attributes & behaviour. It provides several methods that are only applicable to the implementation classes of NavigrableSet interface such as lower(), floor(), and ceiling methods to get elements less than or equal,…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
SortedSet Interface in Java With Program Example
SortedSet is a child interface of Set Interface. It exhibits similar behaviour to its parent interface like not allowing duplicates and preserving insertion order. As its name suggests, the elements present in sortedSet, are always stored in sorting order. By default, it applies natural sorting to arrange the elements in a specific order. For example, in the case of numbers, the elements are…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
Set Interface In Java With Program Example
Set is a child interface of the Collection interface that represents an unordered collection where each element is unique and cannot be repeated. It only consists of methods inherited from its parent interface and doesn’t allow duplicate elements. Further, if someone tries to add a duplicate via add() method, then it would return false, signifying the given element is not able to get added. It is…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
LinkedList Class in Java with Program Example
LinkedList is child class of List and Queue interface. It owns the behaviour of Doubly Linked List and represents its underlying data structure . It is ideal to use when insertion or deletion are the frequent operations. In Linked List, elements are not stored in sequential manner,instead, each element in a Linked List is stored as a separate node, pointing to the previous and next elements in…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
Stack Class in Java with Program Example
Stack extends Vector class that implements Last in first out (LIFO) data structure, introduced in JDK 1.0. The data structure specifies the last element to be added to the stack, is the first one to be removed. It is a subclass of the Vector class that enables it to inherit all the attributes and methods of its parent class. It is considered as a legacy class as it exist even before the…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
Vector Class in Java With Program Example
Vector is a collection class that implements dynamic array data structure to store elements, signifying growable array as its underlying data structure.  It accepts duplicate elements and preserves insertion order. It can hold elements of different data types and allows null value. The Vector class was introduced in Java 1.2 version and is part of the original Java API. It is similar to…
Tumblr media
View On WordPress
2 notes · View notes
blocks2code · 1 year
Text
ArrayList Class in Java With Program Example
Arraylist is a child class of AbstractList and implements List interface. It represents dynamic array that can grow or shrink as needed. In case of standard array, one must know the number of elements about to store in advance. In other words, a standard array is fixed in size and its size can’t be changed after its initialisation. To overcome this problem, collection framework provides…
Tumblr media
View On WordPress
2 notes · View notes
blocks2code · 1 year
Text
Difference between Comparable and Comperator in Java in Tabular Form
In Java, there are two interfaces that provides a way to sort and compare objects, namely Comparable and Comparator. Both interfaces play significant roles in sorting and ordering elements, but they differ in when it comes to identify ordering of elements. The classes that implements Comparable interface support default natural sorting, if one needs to implement a customized sorting order then…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
List Interface in Java With Program Example
List interface inherits Collection interface that provides behaviour to store a group of individual objects. It represents group of individual objects as single entity where duplicates are permitted and elements are ordered in the same manner in which they are inserted. It resides within java.util packages. It defines listIterator() method which returns ListIterator object which empowers the…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
Java Iterable Interface With Program Examples
Iterable is a generic interface that represents elements which can be iterated. It resides in java.lang package and was introduced in 1.5 version. It contains iterator() method that is mandatory to implement by its implementing classes, otherwise objects of that very classes can’t be used within for-each loop. Syntax interface Iterable<T> {} T represents object type required for…
Tumblr media
View On WordPress
0 notes
blocks2code · 1 year
Text
Collections in Java With Program Examples
A collection can be defined as a group of objects (elements) represented as a single entity. Collections in Java can be viewed as Collection Framework which is the most powerful feature. Collection Framework represents a hierarchy of interfaces and classes that is used to manage, handle and store groups of objects efficiently. It resides within java.util package. It wasn’t initially part of Java…
Tumblr media
View On WordPress
0 notes
blocks2code · 2 years
Text
Strike thrpugh backup
function getTextDecorationOperation(action){let textArea=document.getElementById(‘strike-through-text-generator-input’);let text=textArea.value;let…
View On WordPress
0 notes
blocks2code · 2 years
Text
Java Inheritance With Program Example
Java Inheritance With Program Example
Inheritance is an essential feature of object-oriented programming as it enables us to create and manage a hierarchy of classes. With the help of inheritance, a new class can acquire common attributes and behaviour from an existing class, which implies a class can reuse methods or fields of the superclass. Further, it can also have its own additional methods and fields. Inheritance represents the…
Tumblr media
View On WordPress
1 note · View note