flow icon indicating copy to clipboard operation
flow copied to clipboard

Add upper bound wildcard to HasComponents.add()

Open mvysny opened this issue 1 year ago • 1 comments
trafficstars

Describe your motivation

Say I have a List<Button>, I'd like to be able to call verticalLayout.add(buttons) but I can't: Java compiler says there's no add(List<Button>) function.

Describe the solution you'd like

The HasComponents.add() should be changed to add(Collection<? extends Component> components).

Workaround is to call add((Collection<Component>) buttons); but that emits a compiler warning, so it's not pretty.

Vaadin 24.3.3

mvysny avatar Feb 06 '24 08:02 mvysny

Makes sense to do this 👍

mshabarov avatar Feb 13 '24 11:02 mshabarov