Generics ã¯ãã§ã«éèªãªã©ã§è§£èª¬è¨äºãæ¸ããã¦ããã®ã§ãåç¥ã®ãããå¤ããã¨æãã¾ãã Generics ã¨ããã®ã¯ C++ ã®ãã³ãã¬ã¼ãæ©è½ã®ãããªæ©è½ã§ãã²ã¨ãã¨ã§ããã°ã¯ã©ã¹ (ã¤ã³ã¿ãã§ã¼ã¹)ãã¡ã½ããã®ãã©ã¡ã¼ã¿åã¨ãããã¨ãã§ãã¾ãã ã¨ãã£ã¦ãããåãããªãã§ããã ããã§ã¯å®éã«ä¾ã示ãã¾ãããã ã³ã¬ã¯ã·ã§ã³ã¯è¦ç´ ã Object ã¯ã©ã¹ã®ãªãã¸ã§ã¯ãã¨ãã¦ä¿æããããã«ã使ãã¨ãã«ã¯ãã¡ãã¡ãã£ã¹ããè¡ããªãã¦ã¯ããã¾ããã List list = new ArrayList(); list.add(new Integer(10)); int x = ((Integer)list.get(0)).intValue(); // ãã£ã¹ããå¿ è¦
{{#tags}}- {{label}}
{{/tags}}