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ç§ä»¥ä¸ } }
8. Optionalãç¨æãã â å¤ããã Optional.of(str) â nullã渡ãã¨ã¬ãã½ â å¤ããªã Optional.empty() â å¤ããããã©ããããããªã Optional.ofNullable(str) 9. å¤ã®åå¾ â get() â å¤ããªãã¨ãNoSuchElementException â orElse(defaultValue) â å¤ããªãã¨ãdefaultValue â orElseGet(() -> defaultValue) â å¤ããªãã¨ãã«defaultValueåå¾å¦ç â orElseThrow(() -> new Exception()) â å¤ããªãã¨ãä¾å¤ãçæãã¦æãã
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
5. 5 / 54 ã©ã ãå¼ã¨ã¹ããªã¼ã API ⢠ã©ã ãå¼ã¨ã¯é¢æ°ã簡便ã«è¡¨ç¾ããããã®è¨æ³ã ⢠ã¹ããªã¼ã APIã¯ãã©ã ãå¼ãå©ç¨ããã³ã¬ã¯ ã·ã§ã³æä½ç¨ã®API ⢠é¢æ°åããã°ã©ãã³ã°è¨èªç±æ¥ãæ´å²ã¯å¤ãã ⢠ããã¾ã§ã®æç¶ãåããªãã¸ã§ã¯ãæåçãªã ãã°ã©ãã³ã°ææ³ãããé¢æ°åããã°ã©ãã³ã° ã«å¤ããã¾ãã ⢠ãã©ãã¤ã ã·ããã®ãããï¼ï¼ 6. 6 / 54 ç°¡åãªãµã³ã㫠⢠ãã«ã¼ãã®ä¸è¦§ã®ä¸ãã ⢠ååãâãããâã§å§ã¾ãã ⢠å¤æ®µã100å以ä¸ã®ãã®ãã ⢠å¤æ®µé ã§ä¸¦ã³æ¿ãã ⢠ååã ããåãåºãã¦ã ⢠ãªã¹ããä½æãã 1 List<String> apples = fruits.stream() 2 .filter(f -> f.getName().startsWith("ããã")) 3 .filter(f -> f.getPrice() > 10
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}