All Packages Class Hierarchy This Package Previous Next Index
Interface collections.UpdatableBag
- public interface interface UpdatableBag
- extends UpdatableCollection, Bag
UpdatableBags support operations to add multiple occurrences of elements
-
add(Object)
- Add an occurrence of the indicated element to the collection.
-
addElements(Enumeration)
- Add all elements of the enumeration to the collection.
-
addIfAbsent(Object)
- Add an occurrence of the indicated element if it
is not already present in the collection.
add
public abstract void add(Object element) throws IllegalElementException
- Add an occurrence of the indicated element to the collection.
- Parameters:
- element - the element to add
- Returns:
- condition:
occurrences(element) == PREV(this).occurrencesOf(element)+1 &&
Version change: always
- Throws: IllegalElementException
- if !canInclude(element)
addIfAbsent
public abstract void addIfAbsent(Object element) throws IllegalElementException
- Add an occurrence of the indicated element if it
is not already present in the collection.
No effect if the element is already present.
- Parameters:
- element - the element to add
- Returns:
- condition:
occurrencesOf(element) == min(1, PREV(this).occurrencesOf(element) &&
no spurious effects &&
Version change iff !PREV(this).includes(element)
- Throws: IllegalElementException
- if !canInclude(element)
addElements
public abstract void addElements(Enumeration e) throws IllegalElementException, CorruptedEnumerationException
- Add all elements of the enumeration to the collection.
Behaviorally equivalent to
while (e.hasMoreElements()) add(e.nextElement());
- Parameters:
- e - the elements to include
- Throws: IllegalElementException
- if !canInclude(element)
- Throws: CorruptedEnumerationException
- propagated if thrown
All Packages Class Hierarchy This Package Previous Next Index