From ab207e8bbeb6f3bf5b6a45e01ca5a4fb0e0c4f6a Mon Sep 17 00:00:00 2001 From: caalador Date: Thu, 2 Feb 2017 14:39:52 +0200 Subject: [PATCH] Add default getEmptyValue for MultiSelect interface (#8420) (#8421) * Add deafult getEmptyValue for MultiSelect interface (#8420) Added an default implementation for getEmptyValue to the MultiSelect interface. --- .../main/java/com/vaadin/ui/AbstractMultiSelect.java | 5 ----- server/src/main/java/com/vaadin/ui/MultiSelect.java | 11 +++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java index 9947067288..a0c8fd2225 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java @@ -216,11 +216,6 @@ public abstract class AbstractMultiSelect extends AbstractListing updateSelection(copy, new LinkedHashSet<>(getSelectedItems())); } - @Override - public Set getEmptyValue() { - return Collections.emptySet(); - } - /** * Adds a value change listener. The listener is called when the selection * set of this multi select is changed either by the user or diff --git a/server/src/main/java/com/vaadin/ui/MultiSelect.java b/server/src/main/java/com/vaadin/ui/MultiSelect.java index 6519921c88..3c56a22da1 100644 --- a/server/src/main/java/com/vaadin/ui/MultiSelect.java +++ b/server/src/main/java/com/vaadin/ui/MultiSelect.java @@ -136,4 +136,15 @@ public interface MultiSelect extends HasValue>, Serializable { */ public Registration addSelectionListener( MultiSelectionListener 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 getEmptyValue() { + return Collections.emptySet(); + } + } -- 2.39.5