devxlogo

April 24, 2001

Making a Read-only Collection

The Collections class provides static APIs to generate read-only orunmodifiable collections, lists, sets, or maps from specified entities. For instance, if you are sure that the ArrayList you’ve made should

Using the instanceof Keyword in Java

When you are typecasting and using instanceof keyword in Java, there are several things you should keep in mind. Consider the following example program: class Point { int x, y;

How to Choose the Right Data Structure

Following are some tips for matching the most commonly used data structures with particular needs.1. When to use a Hashtable?A hashtable, or similar data structures, are good candidates if the

Using MACRO Definitions

By using MACRO definitions, you can easily write lines of code that are only included in Debug versions and not in Release versions. For instance, if you create a function

The Difference Between Pointers and Arrays

Some programmers believe that int a[] and int * a are equivalent.Also some C++ books to say that pointers and arrays are almost same. This belief usually leads to hard