ã¤ã³ã¹ã¿ã³ã¹ãæ½è±¡çã«æ±ã
ã¾ããæ½è±¡çãã¨ããè¨èãé£ããã®ããªã俺ãæåã®é ãä¸ä½ä½ãªã®ãããããªãã£ããããã°ã©ã ã«å ¨ãç¸ãããããç¡ãç¸æ¹ã«ããªãã¸ã§ã¯ãæåã®è©±ããããã ãèããããã¨ããã£ã¦ããæ½è±¡çã£ã¦ãè¦ã¯å¤§ãã£ã±ã£ã¦ãã¨ï¼ãã¨åãããããªãã»ã©ãè¯ã表ç¾ã ã
ãAndroidæºå¸¯HT-03Aãã¨ãããªãã¸ã§ã¯ãããã£ãã¨ãããããã大ãã£ã±ã«æ±ãï¼ãããå¥ã«ç©ççã«éã«æ±ã訳ã§ã¯ãªãï¼ã¨ã¯ã©ããããã¨ããçµè«ãè¨ãã°ããæèä¸ãç´°ããäºãæ°ã«ããªãã¦è¯ãå ´åã¯ãç´°ããäºãè¨è¿°ããªããã¨ãã ã
- Androidæºå¸¯ã¨ãã¦æ±ã â HT-03Aã§ã¯ãªããDesireãNexusOneã§è¯ãå ´åã¯ãHT-03Aã§ãããã¨ããéå®ãããªã
- æºå¸¯é»è©±ã¨ãã¦æ±ã â Androidæºå¸¯ã§ã¯ãªããã¬ã©ã±ã¼ã§ãè¯ãå ´åã¯ãããããéå®ãããªã
- é»åæ©å¨ã¨ãã¦æ±ã â ããããæºå¸¯ã®è©±ãããªãã¦ãé»åæ©å¨ã®è©±ã¨ããæèã§ããã°ãããã§ãã
- ããç©ä½ã¨ãã¦æ±ã â ããã«æºå¸¯ã§ã¯ãªãã¦ãæã«è§¦ããããç©ä½ã§ããã°ç¨ã足ããå ´å
- "ä½ã"ã¨ãã¦æ±ã â ãããæ¦å¿µãã ã¨ããè¡åãã ã¨ãã§ããããä½ãããã§ããã°è¯ãå ´å
ä¸ã«è¡ãã°è¡ãã»ã©ã大ãã£ã±ã ãã¤ã¾ãæ½è±¡çã ã
話ã¯å°ãå¤ããããã³ã¼ããæ¸ãã¨ããã®ã¯æç« ãæ¸ããã¨ã«ããä¼¼ã¦ãããããäºæã表ç¾ãããå ´åãåãäºæã表ç¾ããã«ããã£ã¦ãã人ã«ãã£ã¦æ¸ãã³ã¼ãã¯å¾®å¦ã«ç°ãªããåã人ãåãäºæã表ç¾ããå ´åã§ãã£ã¦ããæ°å次第ã§å ããªéãã¯ããã ãããããä¸åä¸å¥å ¨ãåãã§ããããã¨ã¯çãããããããªæ¸ãæ¹ããã£ã¦ãæ£è§£ã¯ãªããè¦ã¯ä¼ããããããã°ãããã ã
æèä¸ãå¿ è¦æä½éã®å ·è±¡çï¼æ½è±¡çã®å対èªï¼ãªåèªãé¸ãã§æç« ï¼ã³ã¼ãï¼ãæ¸ããã¨ã¯ã©ããããã¨ããè¦ã¦ãããã
æ¥æ¬èªã§ã®æç« ã®å ´å
ä¾ãã°ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãHT-03Aãæã£ã¦ãããããã¨ãã趣æ¨ã®å 容ãæç« ã§è¡¨ç¾ããå ´åï¼ãã表ç¾æ¸ã¿ã ãã©ï½ï¼ããã® *HT-03A* ãã©ãã©ãæ½è±¡åãã¦ããã¨ãããªãã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãHT-03Aãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãæºå¸¯é»è©±ãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãé»åæ©å¨ãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãããç©ä½ãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãä½ããæã£ã¦ããããã
HT-03Aãæ½è±¡åãã¦ããã®ã ãããããæ½è±¡åã¯ãããä¸ç·ãè¶ããã¨æå³ä¸æã«ãªãããã®ä¾ã§ã¯ã3çªä»¥éãæå³ä¸æã ã
ã§ã¯ãæ½è±¡åã®å対ãå
·è±¡åããã¦ããã¨ã©ããªãã®ãã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãé»ãHT-03Aãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãAndroid1.6ã«ã¢ãããã¼ããã¦ããé»ãHT-03Aãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãAndroid1.6ã«ã¢ãããã¼ããã¦ãã£ã¦ããããé»æ± ããã¿ã£ã¦ãã¦ããé»ãHT-03Aãæã£ã¦ããããã
- ãä»æã®äººã¯ã»ã¼å ¨å¡ãæºå¸¯ãæã£ã¦ãããç§ãAndroid1.6ã«ã¢ãããã¼ããã¦ãã£ã¦ããããé»æ± ããã¿ã£ã¦ãã¦ãã¦"æ»ã"ãã¿ã³ã®å¡è£ ãå¥ãã¦ãã¦ããé»ãHT-03Aãæã£ã¦ããããã
- â¦ï¼ããããã§ããï¼ï½ï¼
ç¡æå³ãªå ·è±¡åã¯ãæå³ä¸æã«ãªããªãã«ãã¦ãç¡é§ã¨æ··ä¹±ãå¼ãèµ·ããã
æç« ãã³ã¼ãããä¸è¦ãªäºæãè¨è¿°ããã·ã³ãã«ãªç¶æ ãä¿ã¤ãã¨ã§ãååã«è¦ä»¶ãæºããããã¤ç解ãç°¡åãªè¡¨ç¾ãã§ãããä¸è¨ä¾æã®ä¸ã§ãè¦ä»¶ãæºããã¦ãã¦ï¼ã¤ã¾ãæå³ä¸æã§ãªãï¼ç解ãç°¡åãªã®ã¯2çªãã¤ã¾ããããæé©ãªæç« ã ãè¨ãæããã¨ãæèã®ä¸ã§æå³ãå£ããªãç¯å²ã§ä¸çªæ½è±¡çãªãã®ãæé©è§£ãªã®ã ã
Javaã§ã®ã³ã¼ãã®å ´å
/** * ãã®ããã°ã©ã ãå®è¡ããã¨ãæ¨æºåºåã« "foo" 㨠"bar" ã表示ãããåºåã®é çªã¯ä¿è¨¼ããªãã */ public class AbstractionSample { public static void main(String[] args) { List<String> strings = new ArrayList<String>(); strings.add("foo"); strings.add("bar"); for (String string : strings) { System.out.pringln(string); } } }
ãã㧠*HT-03A* ã«ãããã®ã List ã ãä¸è¨ã®ã³ã¼ãã®mainã®1è¡ç®ãèãããä¸ã«æ¸ããã³ã¼ã3çªã¨ãã¦ããããæ½è±¡åããã¨4çªä»¥éãå ·è±¡åããã¨1ã2çªã«ãªããçªå·ãå°ããã»ã©å ·è±¡ã大ããã»ã©æ½è±¡ã ã
- ArrayList
strings = new ArrayList (); - AbstractList
strings = new ArrayList (); - List
strings = new ArrayList (); - AbstractCollection
strings = new ArrayList (); - Collection
strings = new ArrayList (); - Iterable
strings = new ArrayList (); - Object strings = new ArrayList
();
å ã«æé©è§£ãè¨ã£ã¦ãã¾ãããä¸è¨ã®ãµã³ãã«ã³ã¼ãã«ããã¦æé©ãª1è¡ç®ã¯ã5çªã§ãããæèã®ä¸ã§æå³ãå£ããªãç¯å²ã§ä¸çªæ½è±¡çãªç©ã ããã ãæå³ãå£ããã¨ã¯ã©ããããã¨ãã¨ããã¨ãç°¡åã«è¨ã£ã¦ãã¾ãã°ã³ã³ãã¤ã«ã¨ã©ã¼ãIterableåã ã¨addã§ããªãããObjectåã ã¨addåºæ¥ãªãä¸ã«æ¡å¼µforæã§åããã¨ãã§ããªããä¸è¨ã®ã³ã¼ããåä½ããä¸ã§ä¸çªæ½è±¡çãªã®ã5çªãªã®ã ã
ï¼ã¡ãªã¿ã«ãjavadocã«ãfooã¨barã®é çªãä¿è¨¼ãããä»æ§ãæ示ããå ´åã¯ã3çªãæé©ããã®è¾ºããé£ãããï¼
æªã ã«ãã©ããã®ã³ã¼ããè¦ãã¨ã1çªã®ã³ã¼ããè¦ããã¨ããããnewããå®è£ åã§ãã®ã¾ã¾åãåããä¸çªé ã使ããªãã¦è¯ãã®ã§æ¥½ãªã®ã ããããããã¯ãæ½è±¡çãªåã§åãåããã¨ããçºæ³ããããããªããããããªããã¾ããããããããæ¢ãã¦1çªã§å®ç¾©ãããã¨ããã信念ãæã£ãé¸æãã¨ããã®ãããå¾ãï¼å¾è¿°ï¼ã
3çªã ã£ãå ´åããArrayListãLinkedListãnewããæã¯Listã§åãããHashMapãnewããæã¯Mapã§åãããHashSetã®æã¯Setâ¦ããã¨ããæèåæ¢ã«ã¼ã«ã«ãã£ã¦æ¸ããã¦ããå¯è½æ§ããããããããç¶æ³ã«å¿ãã¦ããã£ããèããä¸ã§ããã¯ã信念ãæã£ã¦åãé¸æãããã¨ããã ã
信念ãæã£ãåã®é¸æ
ãããã§ããã®ã¤ã³ã¹ã¿ã³ã¹ã«å¿ è¦ã¨ãããæ©è½ã¯ãã©ã®ã¬ãã«ãªã®ããããããèãã¦åãé¸æãããã¨ãããã大äºã
- ãã ä½ãã®Javaãªãã¸ã§ã¯ãã§ããã°ããã®ã§ããã°Objectå
- æ¡å¼µforæã§ï¼é åºãä¿è¨¼ããï¼ãã å ¨è¦ç´ ãåããã°ç¨ã足ããã®ã§ããã°Iterable
- ããã«å ãã¦ãadd/remove/sizeçã®åºæ¬çãªéåæä½ãæ±ããããã®ãªãã°Collection
- ããã«å ãã¦ãè¦ç´ ã®é åºãä¿è¨¼ããç¹å®ã®è¦ç´ ã®ã¤ã³ããã¯ã¹çãæä¾ããå¿ è¦ããããªãã°List
- ensureCapacityï¼ä¸è¨ï¼çã®å¿ è¦æ§ãããã®ãªãã°ãArrayList
ãã¤ãã¼ã ã ArrayList#ensureCapacity(int minCapacity) ã¨ããã¡ã½ããããåç¥ã ããã*1ã
ArrayListã«ã¯ï¼sizeã§ã¯ãªãï¼capacityã¨ããèãæ¹ãããããã®ã¯ã©ã¹ã¯ãé åºä»ããããéåï¼éåï¼ã³ã¬ã¯ã·ã§ã³ï¼ããå é¨çã«ã¯é åã¨ãã¦ç®¡çãã¦ãããé åã«ã¯å¿ ãåºå®ããããµã¤ãºãããã®ã¯ãåç¥ã®éããã§ã¯ArrayListä¸ã«é ãæã£ã¦ããé åã®ãµã¤ãºã10ã§ãããæ¢ã«Listã®è¦ç´ æ°ã¯10ãã¨ããç¶æ³ã§æ°ããè¦ç´ ãaddãããã©ããªããï¼
æ°ããããã£ã¨å¤§ããè¦ç´ æ°ã®é åãnewãã¦ãå¤ãé åããè¦ç´ ãã³ãã¼ããã®ä¸ã§æ°ããè¦ç´ ãå ãããã¨ãããã¨ããããé åã®è¦ç´ æ°ã«ä½è£ãããã°ããã®é åã®æ´æ°ã¯è¡ãããªããã¤ã¾ããArrayListã¸addããå ´åããã®ãé åã®æ´æ°ãä¼´ãaddãã¾ãã¯ãä¼´ããªãaddããèµ·ãããããããã®å®è¡æããã©ã¼ãã³ã¹ã«ï¼å ãã ã¨æããï¼å·®ããããå ãã¨ã¯è¨ãã塵ãã¢ã ã
ããã¢ããªã±ã¼ã·ã§ã³ã§ããäºåæºåã«æéãæãã£ã¦ãããããããã®addãããç¬éã«ã¯æ大éã®ããã©ã¼ãã³ã¹ãçºæ®ãã¦æ¬²ãããã¨ããè¦ä»¶ããã£ãã¨ããã
ArrayList<String> strings = new ArrayList<String>(); // ... è²ã çç¥ // äºåæºåï¼ãã®å¾ãstringsã«è¦ç´ ã3ã¤addãããããã®æãæ大éã®ããã©ã¼ãã³ã¹ãçºæ®ããã strings.ensureCapacity(strings.size() + 3); // ããã©ã¼ãã³ã¹ãè¦æ±ãããå¦çéå§ strings.add("foo"); strings.add("bar"); strings.add("baz"); // ããã©ã¼ãã³ã¹ãè¦æ±ãããå¦ççµäº
ãã®ãããªè¦ä»¶ãæºããããã«ensureCapacityã使ãããï¼ã®ã ã¨æãï½ï¼ãã§ããã®ã¡ã½ããã¯Listã¤ã³ã¿ã¼ãã§ã¤ã¹ã«ã¯ç¡ããArrayListã«ããç¡ããã¨ããç¶æ³ã§ã¯ã信念ãæã£ã¦ArrayListãé¸æããå¿
è¦ãããããã ã
åã®é¸æã¾ã¨ã
ãã®æèã§å¿ è¦ã¨ããããæä½éã®ã¤ã³ã¿ã¼ãã§ã¤ã¹ãæã£ãåãé¸æãããã£ã¦ãã¨ã§ããã
ã§ãããã¯ãã¼ã«ã«å¤æ°ã®åã ãã§ãªããã¡ã½ããã®å¼æ°åã¨æ»ãå¤åã«ã¤ãã¦ãåããããã¡ã½ããã®ä»æ§ãèããæããListãè¿ããã¨ããä»æ§ãæµ®ããã ã¨ãããããããããä½ãèããã«å®è£ ãã¦ã¯ãããªãã
public List<String> getSomethings() { /* ... */ }
ãã®æ»ãå¤ã¯è¦ç´ ã®é åºãä¿è¨¼ããå¿ è¦ã¯ããã ãããï¼ é åºã«æå³ã¯ããã ãããï¼ ç¡ãã¨ãªã£ããããã ãï¼ããã®ãªããgetSomethingsã®javadocã§ãã©ããªé åºãªã®ãæ示ãã¹ããï¼
public Collection<String> getSomethings() { /* ... */ }
è¿ããå¾ã«sizeãåã£ããã§ããå¿ è¦ã¯ããã ãããï¼ åã«æ¡å¼µforæã§åããã¤ã³ã¹ã¿ã³ã¹ã§ããã°ç¨ã足ããªãã ãããï¼ ãããªãã°ãããã ã
public Iterable<String> getSomethings() { /* ... */ }
ãã®ãããªé¸æãããã®ããAPIè¨è¨ãã¨ãã奴ã§ããã楽ããã§ããã
宣ä¼
æ½è±¡åããã¨ãåºæ¥ãäºãæ¸ãããå¿ è¦æä½éã®ãã¨ããã§ããªãã®ã§ãå°æ¥ã®æ¡å¼µã®å¯è½æ§ãæ½°ãã¦ãã¾ãã好ã¾ãããªãç¶æ ããªã®ã§ã¯ãªããï¼
ãã®çãã«ã¤ãã¦ã¯ãæ¥çµã½ããã¦ã¨ã¢2010å¹´9æå·ãJavaã§å§ããããã°ã©ãã³ã° 第5åãã§ãçããã¦ãã¾ããè²·ã£ã¦ãã
æ¥çµã½ããã¦ã¨ã¢ 2010å¹´ 09æå· [éèª]
- ä½è : æ¥çµã½ããã¦ã¨ã¢
- åºç社/ã¡ã¼ã«ã¼: æ¥çµBP社
- çºå£²æ¥: 2010/07/24
- ã¡ãã£ã¢: éèª
- ã¯ãªãã¯: 14å
- ãã®ååãå«ãããã° (13件) ãè¦ã
*1:ç§ãä»èª¿ã¹ã¦ç¥ã£ãï½