Java Collections: Comparable vs Comparator

In Java we can use a Comparable or Comparator interface to sort a collection. Both interfaces have some differences you should know in order for you to make the right decision. Comparable Interface We can only sort the collection by a single member of an element. Comparable affects the current object being sorted. Override compareTo() …

Java Collections: Set

Set Interface What is a set in java? Well a set is an interface that extends the collection interface. A set structure, represents an unordered set of elements that only allows unique elements, no duplicates and at most one null element. In ordered to create a set collection we have to implement the set interface. …

Java Collection: List

What is a list in java? Well, a list is an interface that extends the collection interface. A list structure’s our elements in insertion. A list alone is not enough to create a collection. We have to implement this collection interface, there are 3 different classes the implement list, ArrayList, LinkedList, and Vector. ArrayList The …

Java Collections: Interview Questions

Q1: What is a collection? A java collection is a container that holds objects in a certain structure, is an implementation of a data structure. Many operations can be perform on the data such. Q: What operations can be perform on a collection? All operations, sorting, insertion, manipulation and deletion. Q: What are the benefits …

JavaScript Interview Questions

Q1: List some of the advantages of JavaScript Server interaction is less Feedback to the visitors is immediate Interactivity is high Interfaces are richer Q2: List some of the disadvantages of JavaScript. No support for multithreading No support for multiprocessing Reading and writing of files is not allowed No support for networking applications. Q3: Is …

Design Pattern: Adapter

The Adapter pattern is a structural pattern that allows two objects with incompatible interfaces to interact. Adapter pattern is also known as a wrapper. UML Diagram Example RoundHole that has a function called fits() that takes in a RoundPeg object and returns if it fits. We also have a SquarePeg class that creates incompatible objects, …

Design Pattern: Singleton

The singleton design pattern is one of a kind, The singleton is a creational pattern that makes sure you only have one instance of a class, while providing global access to this object. Requirements: Must use a private constructor preventing new instantiations of this class a static method that acts like a constructor, “getInstance()” that …

Design a site like this with WordPress.com
Get started