Skip to content

Commit

Permalink
Add default getEmptyValue for MultiSelect interface (#8420) (#8421)
Browse files Browse the repository at this point in the history
* Add deafult getEmptyValue for MultiSelect interface (#8420)

Added an default implementation for getEmptyValue to the
MultiSelect interface.
  • Loading branch information
caalador authored and pleku committed Feb 2, 2017
1 parent 0bbee6f commit ab207e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 0 additions & 5 deletions server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java
Expand Up @@ -216,11 +216,6 @@ public void setValue(Set<T> value) {
updateSelection(copy, new LinkedHashSet<>(getSelectedItems())); updateSelection(copy, new LinkedHashSet<>(getSelectedItems()));
} }


@Override
public Set<T> getEmptyValue() {
return Collections.emptySet();
}

/** /**
* Adds a value change listener. The listener is called when the selection * Adds a value change listener. The listener is called when the selection
* set of this multi select is changed either by the user or * set of this multi select is changed either by the user or
Expand Down
11 changes: 11 additions & 0 deletions server/src/main/java/com/vaadin/ui/MultiSelect.java
Expand Up @@ -136,4 +136,15 @@ public default boolean isSelected(T item) {
*/ */
public Registration addSelectionListener( public Registration addSelectionListener(
MultiSelectionListener<T> listener); MultiSelectionListener<T> listener);

/**
* MultiSelect empty value should always be an empty set by default and not
* {@code null}.
*
* @return An empty set, not {@code null}
*/
public default Set<T> getEmptyValue() {
return Collections.emptySet();
}

} }

0 comments on commit ab207e8

Please sign in to comment.