Package net.apartium.cocoabeans.state
Interface CollectionObservable<E,C extends Collection<E>>
- Type Parameters:
E- Element typeC- Collection type
- All Superinterfaces:
Observable<C>
- All Known Subinterfaces:
ListObservable<E>,SetObservable<E>
@AvailableSince("0.0.39")
public interface CollectionObservable<E,C extends Collection<E>>
extends Observable<C>
Represents an observable containing multiple values
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd an element to this observablebooleanaddAll(Collection<? extends E> collection) Add multiple elements to this observablevoidclear()Clear all elements from this observablebooleanRemoves an element from this observablebooleanremoveAll(Collection<? extends E> collection) Remove multiple elements from this observablebooleanRemove all elements matching given predicatebooleanretainAll(Collection<? extends E> collection) Remove all elements not in given collectionsize()Returns an observable representing the size of the observable.Methods inherited from interface net.apartium.cocoabeans.state.Observable
get, map, observe, removeObserver, watch
-
Method Details
-
add
Add an element to this observable- Parameters:
element- element to add- Returns:
- true if successful, else false
- See Also:
-
remove
Removes an element from this observable- Parameters:
element- element to remove- Returns:
- true if successful, else false
- See Also:
-
addAll
Add multiple elements to this observable- Parameters:
collection- elements to add- Returns:
- true if successful, else false
- See Also:
-
removeAll
Remove multiple elements from this observable- Parameters:
collection- elements to remove- Returns:
- true if successful, else false
- See Also:
-
removeIf
Remove all elements matching given predicate- Parameters:
filter- predicate- Returns:
- true if successful, else false
- See Also:
-
retainAll
Remove all elements not in given collection- Parameters:
collection- collection- Returns:
- true if successful, else false
- See Also:
-
clear
void clear()Clear all elements from this observable- See Also:
-
size
Observable<Integer> size()Returns an observable representing the size of the observable. When the size of the current observable changes, the size observable will emit the new size.- Returns:
- size observable
-