Friday, September 25, 2009

Java Version

1. Java 5's BlockingQueue


"The very first interface listed in java.util.concurrent is BlockingQueue, a java.util.Queue subclass. When clients attempt to retrieve elements but none are available, a BlockingQueue encapsulates code that waits until an element becomes available. The Queue class, also new to Java 5, is a new collection class that supports the classic concept of a FIFO (first-in, first out) data structure. Other Java 5 queue implementations include support for removal based on priority, and a collection that acts like a stack."

2. Java 5's DelayQueue

"The queue classes in the Java 5 package java.util.concurrency package provide solutions for common queuing needs. The DelayQueue class provides a blocking queue from which objects cannot be removed until they have been in the queue for a minimum period of time."

3. Copying Arrays in Java 6

"My take is that small simplifications add up dramatically. I'm pleased with how much simpler I can get my Java 5 applications to look than code written with earlier versions of Java. With Java 6, Sun has introduced only a tiny amount of core Java simplification. I'll take it!"

4. Using Foreach Loops in J2SE 1.5

"Instead, you can designate the Catalog class as being "iterable." Making a class iterable tells clients that they can iterate through its contents using a foreach loop. Sun has added to Java a new interface, java.lang.Iterable, that allows you to mark your classes as iterable:"

5. Looking at Varargs in J2SE 1.5

"Java 1.5 is slated to be released by Sun in late summer 2004. It contains many significant new language features and will dramatically alter the look and feel of Java code. The new varargs language feature was introduced to allow more flexibility and simplicity in coding."

6. Java theory and practice: Using Java 5 language features in earlier JDKs

"One category of developers unable to take advantage of Java 5 features are those who develop components, libraries, or application frameworks. Because their customers may still be using JDK 1.4 or earlier and classes compiled with Java 5 cannot be loaded by JDK 1.4 or previous JVMs, using Java 5 language features would limit their customer base to companies that have already transitioned to Java 5."

No comments: