public void unregisterForActivityResult(ActivityResultListener listener) { List<Integer> keysToDelete = Lists.newArrayList(); for (Map.Entry<Integer, ActivityResultListener> mapEntry : activityResultMap.entrySet()) { if (listener.equals(mapEntry.getValue())) { keysToDelete.add(mapEntry.getKey()); } } for (Integer key : keysToDelete) { activityResultMap.remove(key); } }
public ArrayList<String> next() { ArrayList<String> result = Lists.newArrayList(); boolean trailingComma; boolean haveMoreData; do { // Invariant: pos < limit && lookingAtCell() from hasNext() or previous // iteration if (buf[pos] != '"') { // trim the string tokens we pull from the CSV entries, since it's common to include // leading an trailing spaces here result.add(new String(buf, pos, cellLength).trim()); } else { String cell = new String(buf, pos + 1, cellLength - 2); result.add(ESCAPED_QUOTE_PATTERN.matcher(cell).replaceAll("\"").trim()); } trailingComma = delimitedCellLength > 0 && buf[pos + delimitedCellLength - 1] == ','; pos += delimitedCellLength; delimitedCellLength = cellLength = -1; haveMoreData = pos < limit || indexAfterCompactionAndFilling(pos) < limit; } while (trailingComma && haveMoreData && lookingAtCell()); return result; }