@Test public void read_without_saves_returns_empty_list() throws Exception { assertEquals(Collections.emptyList(), store.read("t")); }
List<String> read(String name) { final List<String> allKeys = new ArrayList<>(sharedPreferences.getAll().keySet()); Collections.sort(allKeys); final Pattern pattern = Pattern.compile("^[0-9]+" + Pattern.quote("_" + name) + "$"); final List<String> result = new ArrayList<>(); for (String key : allKeys) { if (pattern.matcher(key).matches()) { result.add(sharedPreferences.getString(key, AutoFiller.EMPTY_FIELD)); } } return result; }
Store { List<String> read(String name) { final List<String> allKeys = new ArrayList<>(sharedPreferences.getAll().keySet()); Collections.sort(allKeys); final Pattern pattern = Pattern.compile("^[0-9]+" + Pattern.quote("_" + name) + "$"); final List<String> result = new ArrayList<>(); for (String key : allKeys) { if (pattern.matcher(key).matches()) { result.add(sharedPreferences.getString(key, AutoFiller.EMPTY_FIELD)); } } return result; } }
Store { List<String> read(String name) { final List<String> allKeys = new ArrayList<>(sharedPreferences.getAll().keySet()); Collections.sort(allKeys); final Pattern pattern = Pattern.compile("^[0-9]+" + Pattern.quote("_" + name) + "$"); final List<String> result = new ArrayList<>(); for (String key : allKeys) { if (pattern.matcher(key).matches()) { result.add(sharedPreferences.getString(key, AutoFiller.EMPTY_FIELD)); } } return result; } Store(SharedPreferences sharedPreferences); }
Store { List<String> read(String name) { final List<String> allKeys = new ArrayList<>(sharedPreferences.getAll().keySet()); Collections.sort(allKeys); final Pattern pattern = Pattern.compile("^[0-9]+" + Pattern.quote("_" + name) + "$"); final List<String> result = new ArrayList<>(); for (String key : allKeys) { if (pattern.matcher(key).matches()) { result.add(sharedPreferences.getString(key, AutoFiller.EMPTY_FIELD)); } } return result; } Store(SharedPreferences sharedPreferences);  }
Store { List<String> read(String name) { final List<String> allKeys = new ArrayList<>(sharedPreferences.getAll().keySet()); Collections.sort(allKeys); final Pattern pattern = Pattern.compile("^[0-9]+" + Pattern.quote("_" + name) + "$"); final List<String> result = new ArrayList<>(); for (String key : allKeys) { if (pattern.matcher(key).matches()) { result.add(sharedPreferences.getString(key, AutoFiller.EMPTY_FIELD)); } } return result; } Store(SharedPreferences sharedPreferences);   }