Java Magazine Is Going Radically Raspberry Pi Your Developer Career Using the Java Naoqi SDK to More Technical
Total Page:16
File Type:pdf, Size:1020Kb
List<Transaction> groceryTransactions = List<Integer> transactionsIds = //MAY/JUNE 2015 / new Arraylist<>(); transactions.stream() .filter(t -> t.getType() == Transaction.GROCERY) for( Transaction t: transactions ){ .sorted(comparing(Transaction::getValue).reversed()) if( t.getType() == Transaction.GROCERY ){ .map(Transaction::getId) groceryTransactions.add(t); .collect(toList()); } } // as a parallel stream: Collections.sort(groceryTransactions, new Comparator(){ List<Integer> transactionsIds = public int compare(Transaction t1, Transaction t2){ transactions.parallelStream() return t2.getValue().compareTo(t1.getValue()); .filter(t -> t.getType() == Transaction.GROCERY) } .sorted(comparing(Transaction::getValue).reversed()) }); .map(Transaction::getId) .collect(toList()); List<Integer> transactionIds = new ArrayList<>(); for( Transaction t: groceryTransactions ){ List<Integer> transactionsIds = transactionsIds.add(t.getId()); transactions.stream() } .filter(t -> t.getType() == Transaction.GROCERY) .sorted(comparing(Transaction::getValue).reversed()) List<Transaction> groceryTransactions = .map(Transaction::getId) new Arraylist<>(); .collect(toList()); for( Transaction t: transactions ){ // as a parallel stream: if( t.getType() == Transaction.GROCERY ){ groceryTransactions.add(t); List<Integer> transactionsIds = {JAVA transactions.parallelStream() } Twenty years of } .filter(t -> t.getType() == Transaction.GROCERY) .sorted(comparing(Transaction::getValue).reversed())language evolution Collections.sort(groceryTransactions, new Comparator(){ .map(Transaction::getId) public int compare(Transaction t1, Transaction t2){ .collect(toList()); and JVM innovation return t2.getValue().compareTo(t1.getValue());GROWS UPList<Integer> transactionsIds} = } transactions.stream() }); INTERVIEWS WITH IOT: MAKING .fiWHAT’Slter(t -> NEW t.getType() ==ROBOTS: Transaction.GROCERY) JAVA 13 MARK REINHOLD 31 COFFEE WITH JAVA 24.sorted(comparing(Transaction::getValue).reversed())IN JPA? 62 INSIDE THE List<Integer>AND transactionIds JOHN ROSE = new ArrayList<>(); .map(Transaction::getId) MACHINE for( Transaction t: groceryTransactions ){ .collect(toList()); ORACLE.COM/JAVAMAGAZINE //table of contents / COMMUNITY 13 15 20 A CONVERSATION A CONVERSATION WITH JOHN ROSE WITH MARK THE MASTERS With Projects Valhalla REINHOLD and Panama, the JVM The changes that have continues to add useful driven Java’s wide use, JAVA IN ACTION SPEAK features. and the changes to come JAVA TECH COMMUNITY 31 48 62 03 Internet of Things Career Architect From the Editor Brewing Java with the More Ideas to Boost Robots Running Wild Warning: Java Magazine is going radically Raspberry Pi Your Developer Career Using the Java NAOqi SDK to more technical. Interact with a USB scale to accurately Study code, go to conferences, but use program companion robots 06 measure your coffee beans and brew the conferences to build your network. 68 ABOUT US Java Nation the perfect cup of Java. 52 Contact Us Calendar of events, the NYJavaSIG, the 38 JCP Executive Series Have a comment? Suggestion? Units of Measurement API, interview Architect Working on Java from Want to submit an article proposal? with Java Champion Arun Gupta Contexts and Dependency Within the JCP Here’s how to do it. 11 Injection: the New Java EE SourcePoint’s Geir Magnusson Jr. Java Books Toolbox discusses the advantages of building Review of Core Java for the Impatient Using strong typing in dependency systems with Java, and how the JCP and news blurbs of other worthy reads injection in Java EE has affected the platform’s evolution. 44 JAVA IN ACTION JAVA TECH New to Java 24 57 Create a Simple Paddle Game blog What’s New in JPA with Microsoft Kinect Deep Learning Attribute conversion, schema Startup Skymind looks to take deep More fun with using Greenfoot learning technology out of the labs and generation, enhanced SQL queries, to drive Kinect from Java and a host of other improvements into the enterprise with an open source highlight JPA 2.1. framework built on Java and Hadoop. 01 ORACLE.COM/JAVAMAGAZINE /////////////////////////////////////////////// MAY/JUNE 2015 EDITORIAL PUBLISHING Editor in Chief Publisher Andrew Binstock Jennifer Hamilton +1.650.506.3794 COMMUNITY Interim Associate Editor Associate Publisher and Audience Kay Keppler Development Director Copy Editors Karin Kinnear +1.650.506.1985 20 Years of Claire Breen, Karen Perkins Audience Development Manager Section Development Jennifer Kurtz Blair Campbell - Java in Action Michelle Kovac - Java in Action, Features ADVERTISING SALES Bob Larsen - Java Nation President, Sprocket Media Yolande Poirier - Java Nation Kyle Walkenhorst +1.323.340.8585 Innovation Technical Reviewers Western and Central US, LAD, and Canada, Sprocket Media Stephen Chin, Reza Rahman, Simon Ritter, IN ACTION JAVA # James Weaver Tom Cometa +1.510.339.2403 1 Development Platform Eastern US and EMEA/APAC, DESIGN Sprocket Media Senior Creative Director Mark Makinney +1.805.709.4745 Francisco G Delgadillo Advertising Sales Assistant Design Director Cindy Elhaj +1.626.396.9400 x 201 Richard Merchán Mailing-List Rentals Contributing Designers Contact your sales representative. Jaime Ferrand, Diane Murray, Arianna Pucherelli RESOURCES TECH JAVA Production Designers Oracle Products Sheila Brennan, Kathy Cygnarowicz +1.800.367.8674 (US/Canada) Oracle Services Since 2002 Since 1999 Since 1995 +1.888.283.0591 (US) Oracle Press Books oraclepressbooks.com ARTICLE SUBMISSION Since 1996 Since 1998 Since 1996 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 Since 1996 Since 2008 Since 1998 [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. Since 1999 Since 2001 Since 1996 Since 2012 Copyright © 2015, 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 at no cost to qualified subscribers by Oracle, 500 Oracle Parkway, MS OPL-3A, Redwood City, CA 94065-1600. Digital Publishing by GTxcel 02 ORACLE.COM/JAVAMAGAZINE /////////////////////////////////////////////// MAY/JUNE 2015 //from the editor / COMMUNITY JAVA IN ACTION BIO Warning: We’re Going Technical Java Magazine heads in a new direction. JAVA TECH everal weeks ago, I was hired by Oracle to ers who work regularly with code. The magazine will head up Java Magazine. This happy event both reflect and cater to our shared love of pro- S means that I get to write about Java from the gramming, our passion for great tools and technolo- very heart of Java. How cool is that? The joy I feel is gies, and the abiding enjoyment we all derive from akin to the excitement of setting out on a journey Java and JVM languages. for which one has long prepared. I’ve been an edi- To do this, we’ll enlist more Java experts, accom- ABOUT US tor of developer publications for many years, most plished programmers, algorithm junkies, design recently heading up Dr. Dobb’s. I’ve also spent much mavens, build wizards, bad-code scolds, experi- of my free time during the last 10 years program- enced teachers, and skilled architects to share their ming in Java and, to a lesser extent, Groovy. wisdom in our pages. We’ll also explore tools— Mixed with the joy of this new work is the aware- especially open source tools—and important open ness of the long road ahead, defined by the end- source projects. point I am driving toward; so, let me share my plans I also expect to remove some sections, mainly for the new direction of our magazine. those that don’t focus tightly on program- In simple terms, I plan to take Java Magazine in ming. There will be fewer case histories in Java blog a radically more technical direction. The editorial Magazine—and those that do appear will bear team and I will be catering squarely to Java develop- directly on a relevant technical topic. We’ll also PHOTOGRAPH BY BOB ADLER/GETTY IMAGES 03 ORACLE.COM/JAVAMAGAZINE /////////////////////////////////////////////// MAY/JUNE 2015 //from the editor / transform other sections. For exam- readers), and to Kay Keppler, who ple, the section that used to con- was the key to making this transi- COMMUNITY tain book blurbs will run detailed tion possible. Learn Java 8 reviews, signed by the reviewers. Finally, allow me to emphasize (The first book review appears on one more point: I really like