6. ã³ã³ãã¤ã«ã«æéããããã class C<T> { C() {} C(T t) {} C(C<T> c) {} static <U> C<U> m(C<U> c) {return c;} public static void main(String... args) { C<String> c = m(new C<>(m(new C<>(m(new C<>())))); // 1ç§ä»¥ä¸ } }
Java SE 8ã§å°å ¥ãããã©ã ãå¼ã¯ãã©ã®ãããªä»çµã¿ã§å®ç¾ããã¦ããã®ã ãããï¼ ã©ã ãå¼ãããæ·±ãç解ãããã¨èããèªè ã«ã¨ã£ã¦ãããã¯æ°ã«ãªããã¼ãã®1ã¤ã ããããã®ç§å¯ããæããããã Java SE 8ã§å°å ¥ãããã©ã ãå¼ã¯ãJavaã®è¨èªä»æ§ã®æ´å²ã«ããã¦æ大ç´ã®å¤æ´ã ã¨ããã¦ããããã ããããã¯ããã¾ã§ãJavaè¨èªã®ææ³ã¬ãã«ã®è©±ã§ãããJavaããã°ã©ã ãå®è¡ããJavaä»®æ³ãã·ã³ï¼JVMï¼ã«æ°ããªä»çµã¿ãå°å ¥ãããããã§ã¯ãªããã¤ã¾ããè¨èªä»æ§ã«é¢ããæ§ãã¼ã¸ã§ã³ã¨ã®ç¸éã¯ã³ã³ãã¤ã©ã¨ã©ã³ã¿ã¤ã ãå¸åãããã¤ãã³ã¼ãã¬ãã«ã§ã®äºææ§ã¯ä¿ããã¦ããã¨ãããã¨ã ã ããã§ã¯ããã®ãããªå¤§ããªå¤æ´ããæ¢åã®JVMã®ä»çµã¿ã®ä¸ã§ã©ã®ããã«å®ç¾ããã®ã ãããããããç¥ããã¨ã¯ãã©ã ãå¼ãããæ·±ãç解ããæå©ãã¨ãªããããããªããJava SE 8ã®ã©ã ãå¼å®ç¾ã®çµç·¯ã¨ä»çµã¿ã«
諸è¬ã®é½åã§ã©ããã¦ãã¡ã¢ãªã潤沢ã§ã¯ãªãç°å¢ã§ã®ãã¹ããè¡ããªããã°ãªããªãå ´åããããã¨æãã¾ãã ã¾ããJava7ããã§ã«EOLã¨ãããã¨ã§Java8ã®éçºãå¤ããªã£ã¦ãããã¨æãã¾ãããJava8ã«ãªã£ã¦åãã¦ééããåé¡ãããã¾ããã ãããªããã§Java8ã§éçºãå§ããé ã®ã話ã§ãã Tomcatã¢ããªãJava7以åã§ã¯éããªãããåãã¦ããã®ã«ãJava8ã§ã¯ã¹ã¯ããã®éåãä¹ãè¶ããã¨æã£ããæ¥ã«ã¢ããªãå¿çããªããªã£ã¦ãã¾ããããè¦ããTomcat(java)ããã»ã¹ããã¾ããã ã¢ããªã±ã¼ã·ã§ã³ãTomcatã®ãã°ãè¦ã¦ãOutOfMemoryErrorãåºã¦ããããã§ããªããä»æ¹ãªãTomcatãèµ·åããªããã¦ãã¹ãåéããã¨ã¾ãããã»ã¹ããµã£ã¨æ¶ãã¦ããâ¦ã ãããªæªè«è©±ã¿ãããªãã¨ããããã¨æããªãã/var/log/messagesãè¦ã㨠Sep 17 01
NullPointerException å«ãã§ãããï¼ãããªã¨ãã«é ¼ãã«ãªãã®ã Java 8 ããå°å ¥ããã Optional ã§ãã ã§ãã null ã®ä»£ããã« Optional ãç©æ¥µçã«ä½¿ãã¨ã³ã¼ãã Optional ã ããã«ãªããç¹ã«æ¬¡ã®ãããªå ´åã«é¢åãããã§ãã Optional<Integer> a ãããã¨ãã a ã®å¤ãäºä¹ãããããã ãã a ã empty ã®å ´å㯠empty ãå¾ããã Optional<Double> a ãããã¨ãã a ã®å¹³æ¹æ ¹ãè¨ç®ãããããã ãã a ã empty ã¾ãã¯è² ã®æ°ã®å ´å㯠empty ãå¾ããããªãã Math.sqrt ãå®å ¨ã«ããï¼è² ã®æ°ã渡ã㨠empty ãè¿ãï¼é¢æ° Optional<Double> safeSqrt(double) ããããã®ã¨ãã¦èãã¦è¯ãã Optional<Integer> a ã¨
ããã¹ããã¼ã¿ãèªã¿è¾¼ãå ´åãè¨èªã«ããããã1è¡ãã¤èªã¿è¾¼ãã§å¦çãã¾ããããã§ã¯ãã®ã¤ãã£ãªã ã"read-lines"ã¨å¼ã¶ãã¨ã«ãã¾ãã ã¹ã¯ãªããè¨èªãªããã ã¨å¤§æµãæåããforeachã§æ¸ãã§ãã¾ã£ã¦ããããã¾ãããåæã®Javaã§ã¯ã¡ãã£ã¨é¢åãªæé ãå¿ è¦ã§ããã æ°ãããã¼ã¸ã§ã³ã§ã¯ã ãã¶ç°¡åç°¡æ½ã«æ¸ããããã«ãªãã¾ããããä»åº¦ã¯ããããããããã¦ãã©ãããªããªã®ããè¯ãããããªããªã£ã¦ãã¾ãï¼å¤§è¢è£ï¼ã ããã§ä»åã¯ã"read-lines"ã®å¤é·ã«ã¤ãã¦ã¾ã¨ãã¦ã¿ã¾ããã æè¿Javaãå§ããæ¹ããã¼ã¸ã§ã³ãå¤ãæã«æ¸ãããã½ã¼ã¹ã³ã¼ããèªãã¨ãã«å½¹ã«ç«ã¤...ããç¥ãã¾ããã ç®æ¬¡ åºæ¬ BufferedReader ï¼Java1.1ï½ï¼ Scannerã¨æ¡å¼µforæ ï¼Java5ï½ï¼ java.nio.file.Filesã¨try-with-resourcesï¼J
12/25 è¿½è¨ JDK8ã§maven releaseãã©ã°ã¤ã³çµç±ã§JARãçæããã¨ãã«javadocãä½æãã¦ã¦ã¨ã©ã¼ã«ãªã£ãã maven-javadoc-pluginã®configuration <additionalparam>-Xdoclint:none</additionalparam> ã追å ãã ãµã¼ãæ§æ ã¤ã³ãã©ã®æ§æãã¡ã¤ã«ã¯chefã§ç®¡ç ã¢ããªã±ã¼ã·ã§ã³ãµã¼ã ç´50å° jetty + Spring Framework 3.2.4 ããããµã¼ã 2å° Jenkins + Spring Framework 3.2.4 å½åã®äºå® 以åãä»ã¡ã³ãã¼ãJDK8ã«ã¢ãããã¼ãã§ãããæ¤è¨¼ãã¦ããã¦ãã¦ãNewRelicã対å¿ãã¦ããªãã£ãããæ念ããã¨ããçµç·¯ããã£ãã®ã§ããããªã«å¤æ´ãç¡ãã ããã¨å¤æã éçºç°å¢ã§è»½ãæ¤è¨¼ JDK7ã§ã³ã³ãã¤ã«ããwarãJDK8ä¸
æ¥æ¬èª Java SE 8 API ããã¥ã¡ã³ã URL å¤æ´ã«ã¤ãã¾ã㦠2015å¹´3æ10æ¥ at 5:10 åå¾ çæ§ ãã¤ã大å¤ãä¸è©±ã«ãªã£ã¦ããã¾ãã ç¾å¨ãJava SE 8 ã«é¢é£ããããã¥ã¡ã³ããå¤§å¹ ã«æ´æ°ãæãã¦ããã¾ãã http://docs.oracle.com/javase/jp/8/ ãã®éç¨ã§ãJava SE 8 API ããã¥ã¡ã³ãã¸ã®ãªã³ã¯ãä¸è¨ã«å¤æ´ããã¾ããã æ§ï¼http://docs.oracle.com/javase/jp/8/api/ æ°ï¼http://docs.oracle.com/javase/jp/8/docs/api/ ããã¯ãUSã®ãªãªã¸ãã«ã®ããã¥ã¡ã³ãããã£ã¬ã¯ããªæ§æãå¤æ´ããããã§ãUSã«ä½µãã¦æ¥æ¬ã§ãä»å¾ãä¸è¨ã®URLãæ£ããURLã¨ãªãã¾ããã¤ãã¾ãã¦ã¯ã大å¤æãå ¥ãã¾ãããä¸è¨ã«å¯¾ãã¦ç¾å¨ããã¯ãã¼ã¯ããã¦ããå ´åã¯æ¹ã
Java8 ã使ãããªããã¨ããã¨ï½¤ãã¯ã Date and Time API ã使ãããªãå¿ è¦ãã§ã¦ãã。 æã Perl çåºèº«ã®äººéããããã¨ï½¤Perl ã®ä¸çã§ã¯ DateTime/Time::Piece ã¨ããã¢ã¸ã¥ã¼ã«ãä¸è¬çã«æ¥ä»ã®è¨ç®ã«ä½¿ããã¦ãã、iandeth.ããã®ããã°ã¨ã³ããªããã¼ãã·ã¼ãã¨ãã¦ããç¥ããã¦ãã。ãã®ãã¤ãè¦æ £ããã¨ã³ããªã®ä½è£ã§ï½¤ä¸è¬çãªæ¥æã®æä½ãå®ç¨çã«æãã¦ãããã¨ã³ããªã欲ããã¦æ¸ãã。 junit ã®ãã¹ãã±ã¼ã¹ã¨ãã¦æ¸ãã¦ããã®ã§ï½¤é©å½ã«ã³ããã㦠QuickJUnit ã§åä½ç¢ºèªããã¨ãã(assertã¯ãã¦ãªããã©)。 ãªã«ãããã°æãã¦ããã ããã¨ãããããã§ã。
渡辺ã§ãã 2014å¹´3æ18æ¥ã«Java8ããªãªã¼ã¹ãããå年以ä¸ãçµéãã¾ããã ãããããããã¯ã·ã§ã³ç°å¢ã§ãJava8ãæ¡ç¨ããã¦ãããã¨æãã¾ãã ã¾ããå æ¥ãAWSç°å¢ï¼Amazon Linuxï¼ã§ããyumã§Java8ãã¤ã³ã¹ãã¼ã«ã§ããããã«ãªãã¾ããã æ©éãJava8/Tomcat8ã§ç°å¢ãæ§ç¯ãããã¨ããã¨ãããããã§ã¼ãªæã§ã¯ã¾ã£ã¦ãã¾ãã¾ããã EC2ã¤ã³ã¹ã¿ã³ã¹ã®ä½æ Amazon Linux AMI 2014.09.1 x86_64 HVM EBS(ami-4985b048) ãå©ç¨ãã¾ããã ã¤ã³ã¹ã¿ã³ã¹ã¿ã¤ãã¯t2.small以ä¸ã¨ããã®ãç¡é£ã§ãããã ã»ããã¢ãã Tomcat8ã¨Java8ãã¤ã³ã¹ãã¼ã«ããæé ã¯ä»¥ä¸ã®éãã§ãã $ sudo yum -y install java-1.8.0-openjdk-devel tomcat8 $ sudo
8. Optionalãç¨æãã â å¤ããã Optional.of(str) â nullã渡ãã¨ã¬ãã½ â å¤ããªã Optional.empty() â å¤ããããã©ããããããªã Optional.ofNullable(str) 9. å¤ã®åå¾ â get() â å¤ããªãã¨ãNoSuchElementException â orElse(defaultValue) â å¤ããªãã¨ãdefaultValue â orElseGet(() -> defaultValue) â å¤ããªãã¨ãã«defaultValueåå¾å¦ç â orElseThrow(() -> new Exception()) â å¤ããªãã¨ãä¾å¤ãçæãã¦æãã
Java 8æ代ã®éçºè ã®ããã®ãããã°ï¼ãã©ãã«è§£æ±ºã®åºæ¬ã»å¿ç¨ãã¯ããã¯ï½JJUG CCC 2014 Springã¾ã¨ããªãã¼ãï¼å¾ç·¨ï¼ï¼1/3 ãã¼ã¸ï¼ Javaéçºã«ããã3大ãã©ãã«ã¨å¯¾çãIDEã®ãããã¬ã¼æ´»ç¨ã®å¿ è¦æ§ãJava 8ããå°å ¥ãããæ°ããã¡ã¢ãªé åã使ãããªãããã®ãã¯ããã¯ãç¬èªã®ãã©ã³ã¶ã¯ã·ã§ãã«ã¡ã¢ãªæ©æ§ãå®è£ ããæå¹æ§ãªã©ããä¼ãããã æ¥æ¬Javaã¦ã¼ã¶ã¼ã°ã«ã¼ãã¯2014å¹´5æ18æ¥ããJJUG Cross Community Conference 2014 Springããéå¬ããããJJUG Cross Community Conferenceãï¼ä»¥ä¸ãJJUG CCCï¼ã¯æ¯å¹´æ¥ã¨ç§ã«éå¬ãããã«ã³ãã¡ã¬ã³ã¹ãåå¿è åãããã¨ãã¹ãã¼ãåãã¾ã§ãJavaï¼JVMã«å°ãã§ãé¢é£ããã°ããã¨ããåºããã¼ãã§ãã¾ãã¾ãªè¬æ¼ãè¡ããã¦ããã åç·¨ã§ã¯ããS
çµè« Java8ã®Optionalã¯è¶ ãã£ããæ±ãããããããGroovyãªããã Optionalã£ã¦ä½? Java 8ã§å°å ¥ãããæ°è¦ã¯ã©ã¹ã®ä¸ã¤ãjava.util.Optionalã¯ãã¡ã½ããã®å®è¡çµæã§æåããå ´åã¨å¤±æããå ´åãããã¨ãã«ããã®è¿ãå¤ã§æåã¨å¤±æã表ç¾ããããã®ãã®ã§ãã Opitonalã¯åä¸è¦ç´ ãä¿æããã³ã³ããåãæåããå ´åã¯è¿ãå¤ãã³ã³ããã§ä¿æããããã®ãè¿ãã(æåæã®è¿ãå¤ãã©ããã³ã°ãã) ã失æãã¯åºå®ã®ã·ã³ã°ã«ãã³(Optional.empty())ã¨ãã¦æ±ã ã¾ããããã ãã®è©±ã¨ããã°ããã ããªã®ã§ãããå¹æã¯ã 失æã®ããå¯è½æ§ã®ããã¡ã½ããã¨ç¡ãã¡ã½ãããã³ã¡ã³ãã§ã¯ãªãããã°ã©ã ã®ä¸é¨ã¨ãã¦æ示ãã両è ã®éããã³ã¼ãã£ã³ã°ä¸ãåºå¥ãã 失æã®ããå¯è½æ§ã®ããã¡ã½ããã¨ç¡ãæ··å¨ã»æ··åãããã¨ã®ãªãããã«ã³ã³ãã¤ã«æãã§ãã¯ãã§ãããã
Groovyããã®ä»æè¿ã®ã¤ã±ã¦ãè¨èªã®ä¸é¨ã§ã¯ã»ã¼ãããã²ã¼ã·ã§ã³æ¼ç®å(?.)ã¨ãããã®ããããããã æ®å¿µãªããJavaã§ã¯ãã®æ¼ç®åã¯ä½¿ããªãããJava8ã§å°å ¥ãããOptionalã¯ã©ã¹ã使ã£ã¦åçã®å¦çãæ¸ãããã©ããªã³ã¼ãã«ãªãããã£ã¦ã¿ãã ã»ã¼ãããã²ã¼ã·ã§ã³æ¼ç®åã¨ã¯ ãªãã¸ã§ã¯ãã®ã¡ã³ããåç §ããéã«ã左辺ãnullã§ãã£ã¦ãNullPointerExceptionã«ãªããã«nullãè¿ã£ã¦ããæ¼ç®åã
ä»å¹´ã¯Dropwizardãçãä¸ãããã¨ãã話ããã©ãã©èãã¾ãã ä»å¹´æµè¡ããããããªãDropwizardãã¬ã¼ã ã¯ã¼ã¯ã使ã£ã¦ã¿ã 2014ãã¬ã¤ã¯ç¢ºå®ï¼Javaãã¼ã¹ã®ãã¼ã¿ãã«ãªWebãã¬ã¼ã ã¯ã¼ã¯ Dropwizard Dropwizardã§Webã¢ããªã±ã¼ã·ã§ã³ãä½ã ãªãªã¼ã¹ãã¼ããã¿ãã¨ãã¼ã¸ã§ã³ã¨ãã¦ã¯2013å¹´3æã«0.6.2ãåºã¦ã2014å¹´6æç¾å¨0.7.xç³»ã®ããã§ãã 0.7.0-SNAPSHOTã®ãªãªã¼ã¹ãã¼ãã¿ãã¨ããUpgraded to Java 7ãã¨ãã£ã¦ãJava 8åºããã ãã©ãªãã¨æã£ããã ããã§æãåºããã®ã§ãããJava 8ãåºãã¨ã話é¡ã«ãªã£ã¦ããSparkã£ã¦ã©ããªãªãã ããï¼ã¨è§¦ã£ã¦ã¿ã¾ããã Spark Micro Web Framework ããããã¼ã¸ã®ä½ãããã¾ãæã㧠http://www.sparkjava.com/
Ktz @ktz_alias ãã¼Javaã£ã¦ãList<Hoge> list = Arrays.asList(new Hoge {{ ... }})ã§ããªãã®ã¼ï¼ 2013-09-03 14:00:37
7. ãã¾ã«ã¿ãå®è£ static Map<BigInteger, List<BigInteger>> cache = new HashMap<>; void doGet(â¦) { BigInteger n = â¦; List<BigInteger> result = cache.get(n); if (result == null) { result = PrimeFactor.divide(n); // ç´ å æ°å解 cache.put(n, result); } // ⦠} 8. ãã¾ã«ã¿ãå®è£ static Map<BigInteger, List<BigInteger>> cache = new HashMap<>; void doGet(â¦) { BigInteger n = â¦; List<BigInteger> result = cache.get(n); if (resu
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}