@Override public void add(V value) { final N namespace = currentNamespace; if (value == null) { clear(); return; } final StateTable<K, N, ArrayList<V>> map = stateTable; ArrayList<V> list = map.get(namespace); if (list == null) { list = new ArrayList<>(); map.put(namespace, list); } list.add(value); }
@Override public void update(List<V> values) throws Exception { Preconditions.checkNotNull(values, "List of values to add cannot be null."); if (values.isEmpty()) { clear(); return; } List<V> newStateList = new ArrayList<>(); for (V v : values) { Preconditions.checkNotNull(v, "You cannot add null to a ListState."); newStateList.add(v); } stateTable.put(currentNamespace, newStateList); }
@Override public void update(List<V> values) throws Exception { Preconditions.checkNotNull(values, "List of values to add cannot be null."); if (values.isEmpty()) { clear(); return; } List<V> newStateList = new ArrayList<>(); for (V v : values) { Preconditions.checkNotNull(v, "You cannot add null to a ListState."); newStateList.add(v); } stateTable.put(currentNamespace, newStateList); }
@Override public void update(List<V> values) throws Exception { Preconditions.checkNotNull(values, "List of values to add cannot be null."); if (values.isEmpty()) { clear(); return; } List<V> newStateList = new ArrayList<>(); for (V v : values) { Preconditions.checkNotNull(v, "You cannot add null to a ListState."); newStateList.add(v); } stateTable.put(currentNamespace, newStateList); }