/** * Removes the data at the specified key string. * * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. */ public void remove(String keyStr) { List<String> keys = split(keyStr, '.'); int numKeys = keys.size(); CollectionData collectionData = this; for (int i = 0; i <= numKeys - 2; ++i) { SoyData soyData = collectionData.getSingle(keys.get(i)); if (!(soyData instanceof CollectionData)) { return; } collectionData = (CollectionData) soyData; } collectionData.removeSingle(keys.get(numKeys - 1)); }
/** * Removes the data at the specified key string. * * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. */ public void remove(String keyStr) { List<String> keys = split(keyStr, '.'); int numKeys = keys.size(); CollectionData collectionData = this; for (int i = 0; i <= numKeys - 2; ++i) { SoyData soyData = collectionData.getSingle(keys.get(i)); if (!(soyData instanceof CollectionData)) { return; } collectionData = (CollectionData) soyData; } collectionData.removeSingle(keys.get(numKeys - 1)); }
/** * Removes the data at the specified key string. * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. */ public void remove(String keyStr) { List<String> keys = split(keyStr, '.'); int numKeys = keys.size(); CollectionData collectionData = this; for (int i = 0; i <= numKeys - 2; ++i) { SoyData soyData = collectionData.getSingle(keys.get(i)); if (soyData == null || !(soyData instanceof CollectionData)) { return; } collectionData = (CollectionData) soyData; } collectionData.removeSingle(keys.get(numKeys - 1)); }