/** * 获取 * * @param key * @return */ public T get(String key) { if (StringUtil.isNotEmpty(key, true) == false) { Log.e( TAG, "get (sp == null" + " || StringUtil.isNotEmpty(key, true) == false >> return null; "); return null; } return Json.parseObject(sp.getString(StringUtil.getTrimedString(key), null), clazz); }
/** * ROOT 获取列表 * * @return */ public List<T> getAllValueList() { Map<String, String> map = getMap(); if (map != null) { List<T> list = new ArrayList<>(); T data; for (String value : map.values()) { data = Json.parseObject(value, clazz); if (data != null) { list.add(data); } } return list; } return null; }