Author Archives: Java QuickTips

O’Reilly Programming Python

      This book is the ultimate Pythonic reference book, the best fit to this role I have yet seen. You will keep this book in the most cherished spot on your book shelf, or else right at your side on your computer desk, because you can almost instantly find any topic on which […]

Java Contents

Classes Methods Encapsulation Inheritance and its types Polymorphism and its types Method Overloading and Method Overridding Abstract Class Interface Difference between Abstract Class and Interface SuperClass and Subclass Object Class Super and This Collection Framework Static Access Modifiers Non Access Modifiers public static void main(String [] args) constructor Inner class Nested Class Constants equals and […]

Historical collection classes

Arrays are defined to be fixed-size collections of the same datatype. They are the only collection that supports storing primitive datatypes. Everything else, including arrays, can store objects. When creating an array, you specify both the number and type of object you wish to store. And, over the life of the array, it can neither […]

Special collection implementations

Read-only collections After you’ve added all the necessary elements to a collection, it may be convenient to treat that collection as read-only, to prevent the accidental modification of the collection. To provide this capability, the Collections class provides six factory methods, one for each of Collection, List, Map, Set, SortedMap, and SortedSet. Collection unmodifiableCollection(Collection collection) […]


Comparable interface The Comparable interface, in the java.lang package, is for when a class has a natural ordering. Given a collection of objects of the same type, the interface allows you to order the collection into that natural ordering. The compareTo() method compares the current instance with an element passed in as an argument. If […]

Map interface

The interface is not an extension of the interface. Instead, the interface starts off its own interface hierarchy for maintaining key-value associations. The interface describes a mapping from keys to values, without duplicate keys, The alteration operations allow you to add and remove key-value pairs from the map. Both the key and value can be […]

List interface

The List extends the to define an ordered collection,permitting duplicates. The interface adds position-oriented operations, as well as the ability to work with just a part of the list. The position-oriented operations include the ability to insert an element or , get an element, as well as remove or change an element. Searching for an […]

Set interface

Set interface The Set interface extends the Collection interface and, by definition, forbids duplicates within the collection.The concrete Set implementation classes rely on the equals() method of the object added to check for equality. Implementations of the Set interface: HashSet and TreeSet. you will use a HashSet for storing your duplicate-free collection. For efficiency, objects […]

Collection Framework Design Concerns

Collection Framework Design Concerns To keep the design simple, instead of providing separate interfaces for optional capabilities, the interfaces define all the methods an implementation class may provide. However, some of the interface methods are optional.Because an interface implementation must provide implementations for all the interface methods, there needed to be a way for a […]

Collections Interface

Collections Interface : Basic adding or removing operation in Collection interface is done using the following * boolean add(Object element) * boolean remove(Object element) The Collection interface also supports query operations: * int size() * boolean isEmpty() * boolean contains(Object element) * Iterator iterator() Group operation Other operations the Collection interface supports are tasks done […]