Layout Managers are used to arrange components in a specific order. The Java Layout Managers allow us to control the positioning and size of GUI form components. Layout Manager is an interface that is implemented by all layout manager classes. Several AWT and Swing classes provide general-purpose layout managers: BorderLayout BoxLayout CardLayout FlowLayout GridBagLayout GridLayout […]
September 19, 2022 | Java | No comments
The Deque interface in java.util package is a queue interface subtype. A linear collection with the ability to insert and remove elements at both ends. Deque is an abbreviation for “double-ended queue” and is usually pronounced “deck.” It can function as either a queue (first-in-first-out/FIFO) or a stack (last-in-first-out/LIFO). Declaration: Methods of Deque interface: Method […]
September 17, 2022 | Java | No comments
The Queue interface extends the Collection interface and is present in java.util package is used to hold the elements about to be processed in FIFO (First In First Out) order. It is an ordered list of objects that can only be used to insert elements at the end of the list and delete elements from […]
September 16, 2022 | Java | No comments
SortedMap is a collection framework interface. It guarantees that the entries are kept in ascending key order. This interface is an extension of the Map interface. TreeMap is the class that implements this interface. Type Parameters: K – the type of keys maintained by this map V – the type of mapped values SortedMap’s parent interface is […]
September 15, 2022 | Java | No comments
The HashMap class is similar to the IdentityHashMap class. The IdentityHashMap implements the Map interface using Hashtable, and when comparing keys, it uses reference-equality rather than object-equality (and values). This class is not intended to be a general-purpose Map implementation. This class is used when the user wants to compare objects by reference. It is […]
September 14, 2022 | Java | 1 comment
What is EnumSet in Java? The EnumSet is a specialized implementation of the Set interface designed for use with enumeration types. It derives from the AbstractSet class and implements the Set interface. Enum sets are internally represented as bit vectors. This is a very compact and efficient representation. This class’s space and time performance should […]
September 13, 2022 | Java | 1 comment
AbstractSet is a Java Collection Framework class that implements the Collection interface and extends the AbstractCollection class. It implements the Set interface in its most basic form. This class does not override any of the AbstractCollection class’s implementations, but instead adds equals() and hashCode() methods. Class Hierarchy: Syntax: Where E is the type of elements […]
September 12, 2022 | Java | 1 comment
The CopyOnWriteArrayList class, which implements the List interface, is introduced in JDK 1.5. It is an enhanced version of ArrayList in which all changes (add, set, remove, and so on) are implemented by making a new copy. It is included in the java.util.concurrent package. Furthermore, it is a data structure that was created for use […]
September 10, 2022 | Java | No comments
The Java Collection Framework includes the AbstractSequential List class, which implements the Collection interface, and the AbstractCollection class. It is used to implement an unmodifiable list, for which one needs to only extend this AbstractList Class and implement only the get() and the size() methods. AbstractSequential List Method: Method Description add(int index, E element) Inserts […]
September 9, 2022 | Java | No comments
This class provides a skeletal implementation of the List interface in order to reduce the effort required to implement this interface in combination with a “random access” data store (such as an array). Abstract List should be used instead of this class for sequential access data (such as a linked list). Declaration: Methods of Abstract […]
September 9, 2022 | Java | No comments