Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
Javaããã°ã©ãã®ã¿ãªããã¯ãJavaã¯åæ¨è«ããªãããå¤æ°ã®åæå®ãããªãã¦ãããªãã¦ããµãããªã©ã¨ã¤ã¸ã¡ãããçµé¨ãããã¨æãã¾ãã ãããããã«åæ¨è«ããã ãã¨Groovyãããããããããã¨ãããã«åæ¨è«ããã ãã¨Scalaããã£ã¦ãããããã¬ã¹ãã欲ããã£ã¦è¨ã£ãã®ã«WiiãXboxãè²·ã渡ãããæãå³ãã£ã人ãå¤ãã®ã§ã¯ãªãã§ããããã ãããªè¯ãåã®Javaããã°ã©ãã®ããã«ãä»å¹´ã¯ãµã³ã¿ãç´ æµãªãã¬ã¼ã³ããæã£ã¦ãã¦ããã¾ãããã åãåãæ¸ãã®ãããµã ãã¨ãã°ã¦ã£ã³ãã¦ãåºãã¦ãã¿ã³ãæ¼ãããã¡ãã»ã¼ã¸ã表示ããããµã³ãã«ãæ¸ãã¨ãããªæãã«ãªãã¾ããã public static void main(String... args){ JFrame f = new JFrame("ãã¹ã"); JButton b = new JButton("æ¼ãã¦"); JText
ããã«ã¡ã¯ @cero_t ã§ãã ä»æ¥ã®ãã¼ãã¯ã»ã»ã»ã©ãã¥ã¿ç¦æ¢ä»¤ï¼ ãã«ã¹ï¼ ããéããã©ã ãç¦æ¢ä»¤ãã§ãã ãã¦ããªããªãã®æ»ãåºãã§ãããä»æ¥ã¯ãã ã®ã©ã ãã®ç´¹ä»ã§ã¯ãªããç¦æ¢ä»¤ã«ä¸»ç¼ãç½®ãã¦èªãã¾ãã ãã®ã¨ã³ããªã¼ã¯ãJava Advent Calendar 2013ã®12/16åã®æ稿ã§ãã http://www.adventar.org/calendars/145 åæ¥ã¯ @sugarlife ããã® JDK 8 æ°æ©è½ãã¤ã¸ã§ã¹ã (JDK 8 Features) ã§ãã ç¿æ¥ã¯ @setoazusa ããã§ãã ã©ã ãç¦æ¢ä»¤ã¯ããå¾ãã®ãï¼ åå¼·ä¼ããã®æ親ä¼ãªã©ã§ããã³ãã³ãã©ã ãç¦æ¢ä»¤ãåºãã®ã§ã¯ãªãããã話é¡ã«ä¸ããã¨ãããã¾ãã ããããç¦æ¢ããçµç¹ãããã§ãããããã¨ããã®ãã決ã¾ãã®çããªã®ã§ããããã ããã«å¾ãã ãã§ã¯é¢ç½ãããã¾ããããè¦ç´ æè¡ã®çºå±ã
JJUG CCC 2013 Springã®ãããã°ããã®ã»ãã·ã§ã³ã§ãJava 8ã®æã話ãã¨ãã¦ãLambdaå¼ãJVMä¸ã§å®è¡ããã«ãããã invokedynamicã使ã£ã¦ãã Lambdaå¼ã®ä»æ§ã¯ãæå³çã«ã¯Samã¿ã¤ããç¶æ¿ããå é¨ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã®ã¯ãã ããlambdaå¼ã使ã£ã¦ããJavaã½ã¼ã¹ãã³ã³ãã¤ã«ãã¦ããå é¨ã¯ã©ã¹ã«å¯¾å¿ãã.classãã¡ã¤ã«ãçæãããªã ã¨ãã話ãèãã¾ãããLambdaã®å®è¡ã«ãå é¨çã«ãã¤ãã³ã¼ããçæãã¦ä½¿ã£ã¦ãããã¨ãã話ã ã£ãã®ã§ãããindy使ã£ã¦ãã£ã¦ã®ã¯ãè¯ãèããã¨è§£ããªãã§ããLambdaã«ãªãããã®åçãªå´é¢ããããã§ãããããï¼ï¼ï¼ ã¨ãããã¨ã§ã調ã¹ã¦ã¿ã¾ããã [:contents] çµè« çµè«ããæ¸ãã¨ãOracleã®Java8ã®JDKã®Javacã¯ãLambdaå¼ã®æ¬ä½ããSAMã¿ã¤ããç¶æ¿ããå é¨ã¯ã©ã¹
ã¿ã¤ãã«ã¯é£ãã§ãã ãã¡ãããæ±ç¨ã©ã¤ãã©ãªãªã®ã§ãStreamã使ã£ã¦ã¯ã¤ãã¯ã½ã¼ããæ¸ããªãããã§ã¯ããã¾ããã ãã ãStreamã§å®çµããã¾ã¾ã§ã¯ã¯ã¤ãã¯ã½ã¼ãã¯æ¸ãã¾ãããListã¨ã®ç¸äºå¤æãå¿ è¦ã§ãã ã§ãStreamã§å®çµããã¾ã¾ã¯ã¤ãã¯ã½ã¼ããæ¸ããªãç´æ¥çè¦å ã¯ããã¤ããã£ã¦ãããã解æ¶ããã¦ã¼ãã£ãªãã£ã¡ã½ãããç¨æããã¦ãã°ããã®ä»¶ã«é¢ãã¦ã¯Streamã§å®çµãããã¨ãã§ããã®ã§ãããã ããã¨ãã£ã¦ãã¾ãã¾åºã¦ãããxxxãæ¸ããªããã解決ããããã®ã¦ã¼ãã£ãªãã£ã¡ã½ããã追å ãã¾ããã°å¹¸ãã«ãªãããã¨ããã¨ãããã§ããªãããã§ãã ããããããªãã§ãããªã¦ã¼ãã£ãªãã£ã¡ã½ãããå¿ è¦ã«ãªãã®ãã¨ããã®ãæ¬é¡ã çµå±ã®ã¨ããListãªã©Collectionã¨ãæ°ãã«è¿½å ãããStreamãå¥æ±ãã«ãªã£ã¦ããã¨ããã«åå ããã£ã¦ãCollectionã¨Streamã®å¤
ãã¦ãååJava8ã®Streamã®ä½¿ãæ¹ããã£ã¨è¦ã¦ã¿ãã®ã§ããã©ãã¯ã¦ãªããã¯ãã¼ã¯ã®ã³ã¡ã³ãã§ãJavaã使ããã¦ããé åã§ãããªè¨èªæ¡å¼µã¯å¿ è¦ãããå¯èªæ§ãæãªããã¦ãã¦åãªãèªå·±æºè¶³ã§ã¯ãªãããã®ãããªã³ã¡ã³ããã¤ãã¦ãã¾ããã å®éã©ããªã®ãèãã¦ã¿ã¾ãã Java8ã®Streamã®ç®ç ã§ã¯ããã¾Javaã使ããã¦ããé åãèãã¦ã¿ã¾ãããã Javaããã¾ãã使ããã¦ããã®ã¯ãã¯ã©ã¤ã¢ã³ããµã¤ãã§ã¯ãªããµã¼ãã¼ãµã¤ãã§ããã¨ãã«ãç´æ¥ã¢ã¯ã»ã¹ãããã¤ãããµã¼ãã¼ã§ã¯ãªããåæ£ãã¼ã¿å¦çã®ããã®HadoopãHBaseãå ¨ææ¤ç´¢ã¨ã³ã¸ã³ã®Luceneãªã©ãããã¯ã¨ã³ãå¦çãè¡ã製åã®ã·ã§ã¢ã大ããããã«è¦ãã¾ãã TwitterãGoogleã§ããJavaã§æ¸ãããããã¯ã¨ã³ããåãã¦ããããã§ããFacebookãåæç³»ã§ã¯Javaã使ã£ã¦ããããã§ãã 大æãµã¼ãã¹ã§ãã
Javaã®ã©ã ãå¼ã®ã¤ãã§ã«å°å ¥ãããã¡ã½ããåç §ããªããªã便å©ãªæãã§ããã¡ã½ããåç §ãã¤ãã£ã¦DuckTypingçãªãã¨ãã§ãã¾ãã HasName ã¨ããé¢æ°åã¤ã³ã¿ãã§ã¼ã¹ãåãå ¥ããGreeterã¯ã©ã¹ã®å®ç¾©*1 public class Greeter { /** é¢æ°åã¤ã³ã¿ãã§ã¼ã¹ã®å®ç¾© */ @FunctionalInterface interface HasName { String getName();} /** ãååãæã£ã¦ãããªãã¸ã§ã¯ãã«æ¨æ¶ããã¦ããããã¡ã½ãã */ public void greet(HasName... targets) { for(HasName it : targets) { System.out.println(it.getName()); }; } } ãHasNameã®é¢æ°åã¤ã³ã¿ãã§ã¼ã¹ã¨åãã·ã°ããã£ãæã¤ã¡ã½ããããæ
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}