Java Tips, Articles and Tutorials Collection

This part contains some tips or personal experience for Java.

  • TreeMap.keySet() returns a sorted set which is similar to TreeSet.
  • Map.keySet() returns a set view of the keys contained in this map. If you modify this set will modify the keys in the Map. For example, if you use Set.retainAll() function. You can create a new set: Set<T> set = new HashSet<T>(Map.keySet()). TreeSet also works here.
  • Set.retainAll(Collection c):Retains only the elements in this set that are contained in the specified collection (optional operation). This is exact the intersection of two sets: A ^ B. The return value tells you the original set changed or not. Remember to test original set isEmpty() or not before to use it.  removeAll(Collection c) provides A – B. And addAll(Collection c) provides A + B.
  • Unlike if-then and if-then-else, the switch statement allows for any number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that “wrap” certain primitive types: Character, Byte, Short, and Integer (discussed in Simple Data Objects ). (Source)

This parts includes good articles, tutorials and books for Java.

IBM DeveloperWorks

The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into “trails”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s