public ContainerDataProvider(CollectionContainer dataContainer) { this.dataContainer = dataContainer; collectionChangeListener = e -> { DataChangeOperation operation = null; switch (e.getChangeType()) { case REFRESH: operation = DataChangeOperation.REFRESH; break; case SET_ITEM: operation = DataChangeOperation.UPDATE; break; case ADD_ITEMS: operation = DataChangeOperation.ADD; break; case REMOVE_ITEMS: operation = DataChangeOperation.REMOVE; break; } fireCollectionChangeListener(operation, e.getChanges()); }; //noinspection unchecked this.dataContainer.addCollectionChangeListener(collectionChangeListener); }