Code example for TreeMap

Methods: getkeySetputAll

0
 
	@Override 
	public Object getItem(int arg0) {		
		@SuppressWarnings("unchecked") 
		Map<String, String> prefs = (Map<String,String>)mPreferences.getAll();
		TreeMap<String, String> sortedPrefs = new TreeMap<String, String>();
		sortedPrefs.putAll(prefs);
		String key = sortedPrefs.keySet().toArray()[arg0].toString();
		 
		HashMap<String, String> hm = new HashMap<String, String>();
		hm.put(key, sortedPrefs.get(key).toString());
		return hm;
	} 
 
	@Override 
	public long getItemId(int arg0) {		
		return arg0;
	} 
 
	@Override 
Experience pair programming with AI  Get Codota for Java