Facebook Twitter

Java 7: Project Coin in code examples. We Recommend These Resources This blog introduces - by code examples - some new Java 7 features summarized under the term Project Coin.

Java 7: Project Coin in code examples

The goal of Project Coin is to add a set of small language changes to JDK 7. These changes do simplify the Java language syntax. Less typing, cleaner code, happy developer ;-) Let's look into that. Thought Spearmints: @SuppressWarnings and its applicability to various program elements. I cooked up a toy Java 5 class that generates warnings of the "unchecked" family when compiled: package pholser.util; import java.util.Arrays; public class Stack<T> { private final Object[] storage; private int top; public Stack() { this.storage = new Object[ 5 ]; } public Stack( final Stack<T> other ) { this.storage = (Object[]) other.storage.clone(); this.top = other.top; final T currentTop = (T) storage[ top ]; } public void push( final T item ) { checkPrecondition( isFull(), "can't push a full stack" ); storage[ top++ ] = item; } public T pop() { checkPrecondition( isEmpty(), "can't pop an empty stack" ); return (T) storage[ --top ]; } public T peek() { checkPrecondition( isEmpty(), "can't peek an empty stack" ); return (T) storage[ --top ]; } @Override public boolean equals( final Object that ) { if ( this == that ) return true; if ( that == null || !

Thought Spearmints: @SuppressWarnings and its applicability to various program elements

GetClass().equals( that.getClass() ) ) return false; final Stack<? > other = (Stack<? Eamonn McManus's Blog: Getting rid of unchecked warnings for casts. Posted by emcmanus on March 30, 2007 at 3:27 AM PDT If you've ever made a serious effort to get rid of "unchecked" warnings from the Java compiler (the ones it gives you with -Xlint:unchecked) then you'll probably have found some cases where you know a cast is correct but you can't convince the compiler of it.

Eamonn McManus's Blog: Getting rid of unchecked warnings for casts

Is there anything better than adding @SuppressWarnings("unchecked") around the whole method? 10 examples of Enum in Java - What is Enum in Java Enum in Java is a keyword, a feature which is used to represent fixed number of well known values in Java, For example Number of days in Week, Number of planets in Solar system etc.

10 examples of Enum in Java -

Enumeration (Enum) in Java was introduced in JDK 1.5 and it is one of my favorite features of J2SE 5 among Autoboxing and unboxing , Generics, varargs and static import. One of the common use of Enum which emerged in recent years is Using Enum to write Singleton in Java, which is by far easiest way to implement Singleton and handles several issues related to thread-safety and Serialization automatically. By the way, Java Enum as type is more suitable to represent well known fixed set of things and state, for example representing state of Order as NEW, PARTIAL FILL, FILL or CLOSED. Enumeration(Enum) was not originally available in Java though it was available in other language like C and C++ but eventually Java realized and introduced Enum on JDK 5 (Tiger) by keyword Enum. Java SE APIs & Documentation. Get Ready for Java 7 with the Free JDK 7 Reference Card.

Oracle submitted the release content for both Java SE 7 and 8 to the JCP at the end of last year.

Get Ready for Java 7 with the Free JDK 7 Reference Card

The JDK 7 and 8 JSRs represented Oracle's "Plan B" approach for separating JDK 7 into two separate releases. In the months since, JDK 7 has progressed to the Developer Preview milestone and the final version isn't too far off. Java Basics: Table of Contents [First Draft - June 2005] Trail: Essential Classes: Table of Contents (The Java™ Tutorials) Trail: JDBC(TM) Database Access: Table of Contents (The Java™ Tutorials)

Java Programming Notes. Java Notes.

Java Programming Notes

These Java programming notes are written to fill in missing or weak topics in textbooks that I've taught from. Many pages are useful for reference, but not as an ordered tutorial. Some pages are still rough drafts, but I'm slowly working on fixing them. notes-java-2007-04-25.zip [2.4 MB]. Java Basics.


Top Ten New Things You Can Do with NIO. New I/O? Why do we need a new I/O? What's wrong with the old I/O? There's nothing wrong with the classes in the java.io package; they work just dandy -- for what they do. Annotations. Many APIs require a fair amount of boilerplate code.


For example, in order to write a JAX-RPC web service, you must provide a paired interface and implementation. This boilerplate could be generated automatically by a tool if the program were “decorated” with annotations indicating which methods were remotely accessible. Other APIs require “side files” to be maintained in parallel with programs. For example JavaBeans requires a BeanInfo class to be maintained in parallel with a bean, and Enterprise JavaBeans (EJB) requires a deployment descriptor.