Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin 8 + ComboBox<String> + Stream -> ClassCastException

Alexander Wagner
5 years ago Jan 22, 2017 10:59am

Version: 8.0.0.beta1

If you want to put a stream into a ComboBox<String> you get a ClassCastException if you click on the ComboBox.
Problem is that the ComboBox does not override setItems(Stream stream) and so convertFilter will not be invoked as it is by setItems(Collection coll).

Sample to reproduce:

ComboBox<String> cb = new ComboBox<>();
List<String> items = new ArrayList<>();
items.add("Item 1");
items.add("Item 2");
items.add("Item 3"); 
cb.setItems(items.stream()); // cb.setItems(items) would work! 
vl.addComponent(cb);