Java Version « Language « Java Articles

Home
Java Articles
1.Build Deploy
2.Class
3.Core Library
4.Data Types
5.Database JDBC
6.Design
7.Development
8.File Input Output
9.Graphics Desktop
10.J2EE Enterprise
11.J2ME Wireless
12.JVM
13.Language
14.Library Product
15.Network
16.Security
17.SOA Web Services
18.Test
19.Web Development
20.XML
Java Articles » Language » Java Version 
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.

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.

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!

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:

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.

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.

w___ww._j__a___v___a__2s__.___c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.