This article summarizes top questions asked about C/C++ pointers on stackoverflow.com. Pointers are the most confusing part of C/C++, those questions use simple examples to explain key pointer concepts.
Month: September 2013
Top 9 questions about Java Maps
In general, Map is a data structure consisting of a set of key-value pairs, and each key can only appears once in the map. This post summarizes Top 9 FAQ of how to use Java Map and its implemented classes. For sake of simplicity, I will use generics in examples. Therefore, I will just write Map
instead of specific Map
. But you can always assume that both the K and V are comparable, which means K extends Comparable
and V extends Comparable
.
Java hashCode() and equals() Contract for the contains(Object o) Method of Set
The article is about hashCode and equals contract used for the contains(Object o) method in Set.
The substring() Method in JDK 6 and JDK 7
The implementation of the substring(int beginIndex, int endIndex)
method in JDK 6 is different from JDK 7. This post explains the differences. For simplicity reasons, the substring()
method represents the substring(int beginIndex, int endIndex)
method in this post.
Top 10 questions about Java Collections
The following are the most popular questions of Java collections asked and discussed on Stackoverflow. Before you look at those questions, it’s a good idea to see the class hierarchy diagram. 1. When to use LinkedList over ArrayList? ArrayList is essentially an array. Its elements can be accessed directly by index. But if the array … Read more
Top 8 Diagrams for Understanding Java
A diagram is sometimes worth 1000 words. The following diagrams are from Java tutorials on Program Creek, they have received the most votes so far. Hopefully, they can help you review what you already know. If the problem is not clear by the diagram itself, you may want to go to each article to take a further took.
Java Reflection Tutorial
What is reflection? “Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java virtual machine.” This concept is often mixed with introspection. The following are their definitions from Wiki: Introspection is the ability of a program to examine the type or properties … Read more
String is passed by “reference” in Java
This is a classic question of Java. Many similar questions have been asked on stackoverflow, and there are a lot of incorrect/incomplete answers. The question is simple if you don’t think too much. But it could be very confusing, if you give more thought to it.
Top 10 questions of Java Strings
The following are top 10 frequently asked questions about Java Strings.
1. How to compare strings? Use “==” or use equals()?
In brief, “==” tests if references are equal and equals() tests if values are equal. Unless you want to check if two strings are the same object, you should always use equals().
Top 10 Methods for Java Arrays
The following are top 10 methods for Java Array. They are the most voted questions from stackoverflow. 0. Declare an array String[] aArray = new String[5]; String[] bArray = {"a","b","c", "d", "e"}; String[] cArray = new String[]{"a","b","c","d","e"};String[] aArray = new String[5]; String[] bArray = {"a","b","c", "d", "e"}; String[] cArray = new String[]{"a","b","c","d","e"}; 1. Print an … Read more
Python: Convert Image to String, Convert String to Image
To store or transfer an image, we often need to convert an image to a string in such a way that the string represents the image. Like other programming languages (e.g. Java), we can also convert an image to a string representation in Python.