Skip to content

Commit

Permalink
Make SelectionMenu#getOptions return an unmodifiable list (#1922)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Spieß <business@minn.dev>
  • Loading branch information
freya022 and MinnDevelopment committed Dec 2, 2021
1 parent 78803d6 commit 2fe9609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Expand Up @@ -81,9 +81,11 @@ public interface SelectionMenu extends Component
int getMaxValues();

/**
* Up to 25 available options to choose from.
* An <b>unmodifiable</b> list of up to 25 available options to choose from.
*
* @return The {@link SelectOption SelectOptions} this menu provides
*
* @see Builder#getOptions()
*/
@Nonnull
List<SelectOption> getOptions();
Expand Down
Expand Up @@ -24,6 +24,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SelectionMenuImpl implements SelectionMenu
Expand Down Expand Up @@ -52,7 +53,7 @@ public SelectionMenuImpl(String id, String placeholder, int minValues, int maxVa
this.minValues = minValues;
this.maxValues = maxValues;
this.disabled = disabled;
this.options = options;
this.options = Collections.unmodifiableList(options);
}

private static List<SelectOption> parseOptions(DataArray array)
Expand Down

0 comments on commit 2fe9609

Please sign in to comment.