Java Magazine Is Provided on an “As Is” Basis
Total Page:16
File Type:pdf, Size:1020Kb
//table of contents / 05 28 66 COMMUNITY FROM SMART JAVA ME 8 AND GRIDS TO THE INTERNET JAVA 8: JAVA MICROBREWS OF THINGS V2COM uses Java to Top features of EXPLORE THE connect millions of Java ME 8 POSSIBILITIES intelligent devices. JAVA IN ACTION From embedded to the cloud, get there with Java 8. Java 8 Is Here JAVA TECH New theme icon. See how it works. COMMUNITY JAVA TECH 50 62 03 33 Java Architect Embedded From the Editor New to Java Processing Data with JavaFX and Near 15 How to Become an Java SE 8 Streams Field Communication Java Nation Embedded Developer Use stream operations to on the Raspberry Pi ABOUT US News, people, books, in Minutes express sophisticated data Use your Java skills to create and events Jump into programming processing queries. end-to-end applications that the next big thing using 56 span card readers on embedded 23 embedded Java. devices to back-end systems. JCP Executive Series Java Architect Q&A with Goldman Sachs 41 JSR 308 Explained: 69 John Weir and Donald Raab New to Java Java Type Annotations Polyglot discuss the impact of Three Hundred Sixty– The benefits of type annotations Take Time to Play lambda expressions. Degree Exploration and example use cases Learn how to take advantage of Java EE 7 of the client tier. Part 3 in our series 75 on Java EE 7 Fix This blog Take our concurrency code challenge! COVER ART BY I-HUA CHEN 01 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////////////// MARCH/APRIL 2014 EDITORIAL PUBLISHING Editor in Chief Vice President Caroline Kvitka Jeff Spicer COMMUNITY Community Editors Publisher Cassandra Clark, Sonya Barry, Jennifer Hamilton +1.650.506.3794 Yolande Poirier Associate Publisher and Audience Java in Action Editor Development Director Michelle Kovac Karin Kinnear +1.650.506.1985 Technology Editors Janice Heiss, Tori Wieldt ADVERTISING SALES President, Sprocket Media Contributing Writer Kyle Walkenhorst +1.323.340.8585 Kevin Farnham Western and Central US, LAD, and Contributing Editors Canada, Sprocket Media Claire Breen, Blair Campbell, Karen Perkins Tom Cometa +1.510.339.2403 IN ACTION JAVA DESIGN Eastern US and EMEA/APAC, Senior Creative Director Sprocket Media Francisco G Delgadillo Mark Makinney +1.805.709.4745 Senior Design Director Advertising Sales Assistant Suemi Lam Cindy Elhaj +1.626.396.9400 x 201 Design Director Mailing-List Rentals Richard Merchán Contact your sales representative. Contributing Designers RESOURCES TECH JAVA Jaime Ferrand, Arianna Pucherelli Oracle Products Production Designers +1.800.367.8674 (US/Canada) Sheila Brennan, Kathy Cygnarowicz Oracle Services +1.888.283.0591 (US) Oracle Press Books oraclepressbooks.com ARTICLE SUBMISSION ABOUT US If you are interested in submitting an article, please e-mail the editors. SUBSCRIPTION INFORMATION Subscriptions are complimentary for qualified individuals who complete the subscription form. MAGAZINE CUSTOMER SERVICE [email protected] Phone +1.847.763.9635 PRIVACY Oracle Publishing allows sharing of its mailing list with selected third parties. If you prefer that your mailing address or e-mail address not be included in this program, contact Customer Service. Copyright © 2014, Oracle and/or its affiliates. All Rights Reserved. No part of this publication may be reprinted or otherwise reproduced without permission from the editors. JAVA MAGAZINE IS PROVIDED ON AN “AS IS” BASIS. ORACLE EXPRESSLY DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM YOUR USE OF OR RELIANCE ON ANY INFORMATION PROVIDED HEREIN. The information is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied blog upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Oracle and Java are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Java Magazine is published bimonthly with a free subscription price by Oracle, 500 Oracle Parkway, MS OPL-3C, Redwood City, CA 94065-1600. Digital Publishing by GTxcel 02 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////////////// MARCH/APRIL 2014 //from the editor / COMMUNITY FIND YOUR JAVA IN ACTION hange is good—when it comes with benefits. In the case of Java 8, those benefits come in the JUG HERE form of more productivity for developers plus expanded opportunities to develop applications that span from My local and global JUGs embedded devices to the cloud. Java 8 is here—you can download Java SE 8 today, while Java are great places to network C JAVA TECH Java 8 ME 8 is available in Early Access form. We’ve dedicated most of this issue to Java 8—just look both for knowledge and work. Is Here My global JUG introduces for the theme icon for articles on this topic. me to Java developers all The biggest change in Java SE 8—what some have called the most significant upgrade to the Java program- over the world. ming language ever—is lambda expressions, or closures. “Lambda expressions are anonymous methods that Régina ten Bruggencate JDuchess provide developers with a simple and compact means for representing behavior as data,” explains Brian Goetz, Java language architect at Oracle. “In a few years, developers will wonder how they ever lived without [them].” LEARN MORE ABOUT US There’s plenty more to get excited about, including Nashorn, a next-generation JavaScript engine; Compact Profiles, which offer a convergence of the Java ME Connected Device Configuration (CDC) product with Java SE 8; and a new date and time API. You, the Java community, also played a huge role in bringing Java 8 to fruition. We examine all that and more in our Java 8 cover story. In “Java ME 8 and the Internet of Things,” we explore the new features that make //send us your feedback / Java ME 8 a comprehensive platform for connected devices. And if you’re ready to get We’ll review all going with embedded development, Angela Caicedo shows you how. suggestions for future improvements. This issue is jam-packed with information to get you started with Java 8 (including Depending on volume, articles on streams and type annotations). So go on . embrace change and explore some messages may the possibilities. Let us know where you take Java 8. not get a direct reply. blog Caroline Kvitka, Editor in Chief BIO PHOTOGRAPH BY BOB ADLER 03 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////////////// MARCH/APRIL 2014 COMMUNITY 1. LAMBDA EXPRESSIONS 2. NASHORN AND JAVASCRIPT 3. COMPACT PROFILES JAVA IN ACTION JAVA 4. DATE AND TIME API EXPLORE THE 5. JAVAFX 8 POSSIBILITIES 6. COMMUNITY INVOLVEMENT JAVA 7. JAVA ME 8 TECH JAVA 8. JAVA SE 8 AND THE JVM ABOUT US Java 8 From embedded to the cloud, get there with Java 8. Is Here BY TIMOTHY BENEKE ava 8, which encompasses both Java SE 8 and Java ME 8, might be the most significant expan- sion of the Java platform yet. JLambda expressions and the Stream API increase the expres- sive power of the platform and blog make it easier for developers to take advantage of modern, multicore processors. Compact Profiles in Java SE 8 allow developers to use just ART BY I-HUA CHEN 05 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////////////// MARCH/APRIL 2014 COMMUNITY a subset of the platform, 1 and are a significant step toward the convergence of Java SE and Java ME. Java ME 8 itself, meanwhile, has JAVA IN ACTION JAVA been updated to include more-recent Java Virtual LAMBDA Machine (JVM), language, and library features while retaining the focus on small EXPRESSIONS embedded devices. Java 8 allows developers to apply TECH JAVA the same skill set across Lambda expressions are at the over behavior. As Goetz explains, readability, and performance.” a wide range of scenarios, heart of Java SE 8. “Lambda “If we want to model a workflow According to Goetz, the typical from the smallest embed- expressions, also known as clo- such as ‘do A before you start, do developer’s initial experience with ded Internet of Things (IoT) sures, are anonymous methods B for every file in this group, do C lambda expressions is likely to be devices to enterprise serv- that provide developers with a if you encounter an error, and do through the powerful new APIs ers in the cloud. simple and compact means for D when you’re done,’ for manipulating ABOUT US As Mark Reinhold, chief representing behavior as data,” we don’t have ideal collections. Business architect of the Java Platform explains Brian Goetz, Oracle’s tools for express- “This is the most logic typically is full Group at Oracle, put it, “Java Java language architect and ing the behaviors A significant upgrade of ad hoc query-like 8 is the first truly revolution- Specification Lead for JSR 335, through D, and this of the Java calculations over ary release we’ve done in a Lambda Expressions for the Java affects the sort of collections; the core very long time.” Programming Language. “This APIs we design. We programming model libraries now make Here, we take a look at enables the development of have to break up ever. In a few years, it easier to express eight key pieces of Java 8. libraries that do a better job of the phases of the the “what” of such abstracting over behavior, which workflow, and the developers will a query without in turn leads to more-expressive, client code has to be wonder how they getting bogged less error-prone code.” directly involved in ever lived without it.