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
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
Use the java.lang.Runtime run a program in a separate process.Here
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;
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
The java.net.HttpURLConnection class provides HTTP specific functionality. First you need to open an HttpURLConnection: URL url = new URL(
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
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
For example the following code is incorrect: const char *foo(){ char buf[1024]; strcpy(buf,
If you have coded a template class and use it from VC++, you will get a LNK2001 error message on template member functions. This is because Microsoft deviates a bit