fastutilã®æ³¨æç¹
WEB+DB PRESS Vol.60ã§ããfastutilã¨suxã«ãã大è¦æ¨¡ãã¼ã¿å¦çãã¨é¡ãã¦ãããªããã£ãã³ã¬ã¯ã·ã§ã³ã©ã¤ãã©ãªã®fastutilã¨ãç°¡æ½ãã¼ã¿æ§é ã©ã¤ãã©ãªã®suxãç´¹ä»ããè¨äºãæ¸ãã¾ããã
- ä½è : ã¾ã¤ãã¨ããã²ã,西尾泰å,å±±ç°æ²æ,åæ¸å¿ ä¹,å¢äºä¿ä¹,ç¾½çç« æ´,uupaa,ããã¯,å¡ä¸å¿å¤«,åæ ,奥ä¸ç©,ã¯ã¾ã¡ã2,大沢åå®,å¾é·å,æµæ¬éç,ä¸å³¶æ,ä¸å³¶è¡,ç¢éãã,è§ç°ç´è¡,è½ç»ä¿¡æ´,ç°æå²ä¹,åæè²,çµåäºç å,è§è°·ä¿¡å¤ªé,ç³æ©ç§ä»,WEB+DB PRESSç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2010/12/22
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 12人 ã¯ãªãã¯: 185å
- ãã®ååãå«ãããã° (24件) ãè¦ã
fastutil: http://fastutil.dsi.unimi.it/
sux: http://sux.dsi.unimi.it/
fastutilã¯ç¹ã«æ±ç¨æ§ãé«ãããããããªå ´é¢ã§ä½¿ããã©ã¤ãã©ãªã ã¨æãã®ã§ãããè¨äºã«æãã¦ããªã注æç¹ãè¥å¹²ããã®ã§ã以ä¸ã«æ¸ãããã¨æãã¾ãã
ã¡ã½ããåã®åãéãã«ããæãã¬autoboxingã®çºç
fastutilã§ã¯ãããªããã£ããªã¹ãã¯java.util.Listã¨ãããªããã£ããããã¯java.util.Mapã¨äºææ§ãæã£ã¦ãã¦ä¾¿å©ãªã®ã§ããããã®åé¢ãget()ã¡ã½ãããjava.util.List#get()ãjava.util.Map#get()ãå®è£ ãã¦ãããããä½æ°ãªãget()ã¡ã½ããã使ãã¨autoboxingãçºçãã¦ãã¾ãã¾ãã
ä¾ãã°IntArrayListã«ã¯ä»¥ä¸ã®2種é¡ã®getã¡ã½ããããããããªããã£ãå¤ãç´æ¥åå¾ããã«ã¯å¾è ã®getInt()ã¡ã½ãããå¼ã¶å¿ è¦ãããã¾ãã
- Integer get(int index);
- int getInt(int index);
Mapã®ã¤ãã¬ã¼ã·ã§ã³ãé ã
fastutilã®ããã©ã¼ãã³ã¹ã¯ãå ¨ä½çã«Mahout CollectionsãTroveãããåªç§ãªã®ã§ãããMapã®ã¤ãã¬ã¼ã·ã§ã³ã«é¢ãã¦ã¯å£ã£ã¦ãã¾ãã
Mahout CollectionsãTroveã®Mapå®è£ ã§ã¯ã以ä¸ã®ããã«å é¨ã¤ãã¬ã¼ã¿ã使ã£ã¦é«éãªã¤ãã¬ã¼ã·ã§ã³ãã§ããã®ã§ãããfastutilã«ã¯ãããããã¾ããã
// Mahout Collectionsã®å ´å OpenIntIntHashMap map = new OpenIntIntHashMap(); ... map.forEachPair(new IntIntProcedure() { @Override public boolean apply(int key, int value) { // ä½ããã®å¦ç return true; } });
fastutilã®ãããã§é«éãªã¤ãã¬ã¼ã·ã§ã³ããããå ´åã¯ãåãããã¯ã©ã¹ãç¶æ¿ãã¦ãå é¨ã¤ãã¬ã¼ã¿ãå®è£ ããæ¹ãè¯ãã¨æãã¾ãã
ããã¾ã§ããããªãã¨ããå ´åãfastutilã§ã¯ä»¥ä¸ã®ããã«fastIteratorã¨ããå¤é¨ã¤ãã¬ã¼ã¿ã使ãã¾ããè¨è¿°ãå°ãåé·ã«ãªãã¾ãããé常ã®ã¤ãã¬ã¼ã¿ããã¯é«éã§ãã
Int2IntMap map = new Int2IntOpenHashMap(); ... Int2IntMap.FastEntrySet entrySet = (Int2IntMap.FastEntrySet) map.int2IntEntrySet(); ObjectIterator<Int2IntMap.Entry> it = entrySet.fastIterator(); while (it.hasNext()) { Int2IntMap.Entry e = it.next(); int key = e.getIntKey(); int value = e.getIntValue(); // ä½ããã®å¦ç }