Back to project page CakeUI.
The source code is released under:
GNU General Public License
If you think the Android project CakeUI listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cakeui.utils; //w w w . j a v a 2 s . c o m import java.util.Iterator; import java.util.Set; import java.util.TreeMap; /** * * @author Mariana Azevedo * @email mariana@bsi.ufla.br * * @author Sarah Caixeta * @email caixeta.sarah@gmail.com * * Class that implements a generic TreeMap. * */ public class CakeMap<T, E> extends TreeMap<T, E> { /** * */ private static final long serialVersionUID = 4162502760579250465L; public CakeMap(){ super(new CakeComparator<T>()); } public T getKeyFromIndex(int index){ int indexOf = 0; Set<T> set = this.keySet(); Iterator<T> itSet = set.iterator(); while (itSet.hasNext()){ T object = itSet.next(); if (indexOf == index) return object; indexOf++; } return null; } public E getEntryFromIndex(int indexKey){ T keyObject = getKeyFromIndex(indexKey); E entryObject = this.get(keyObject); return entryObject; } }