@Override protected void closeImplementation() { for (ChangeNotifier<T> provider : changeNotifiers) { provider.close(); } }
private boolean areAllInitial(List<ChangeNotifier<T>> changeNotifiers) { for (final ChangeNotifier<T> changeNotifier : changeNotifiers) { if (!ChangeNotifiers.isInitialEmptyData(changeNotifier.current())) { return false; } } return true; } }
/** * Create a new aggregating {@link ChangeNotifier}. * * @param changeNotifiers the notifiers to aggregate */ AggregatingChangeNotifier(final Iterable<ChangeNotifier<T>> changeNotifiers) { this.changeNotifiers = ImmutableList.copyOf(changeNotifiers); // Set up forwarding of listeners for (final ChangeNotifier<T> changeNotifier : this.changeNotifiers) { changeNotifier.setListener(new Listener<T>() { @Override public void onChange(final ChangeNotification<T> ignored) { checkChange(); } }, false); } records = aggregateSet(); }
private boolean areAllInitial(List<ChangeNotifier<T>> changeNotifiers) { for (final ChangeNotifier<T> changeNotifier : changeNotifiers) { if (!ChangeNotifiers.isInitialEmptyData(changeNotifier.current())) { return false; } } return true; } }
/** * Create a new aggregating {@link ChangeNotifier}. * * @param changeNotifiers the notifiers to aggregate */ AggregatingChangeNotifier(final Iterable<ChangeNotifier<T>> changeNotifiers) { this.changeNotifiers = ImmutableList.copyOf(changeNotifiers); // Set up forwarding of listeners for (final ChangeNotifier<T> changeNotifier : this.changeNotifiers) { changeNotifier.setListener(new Listener<T>() { @Override public void onChange(final ChangeNotification<T> ignored) { checkChange(); } }, false); } records = aggregateSet(); }
private Set<T> aggregateSet() { if (areAllInitial(changeNotifiers)) { return ChangeNotifiers.initialEmptyDataInstance(); } ImmutableSet.Builder<T> records = ImmutableSet.builder(); for (final ChangeNotifier<T> changeNotifier : changeNotifiers) { records.addAll(changeNotifier.current()); } return records.build(); }
@Override protected void closeImplementation() { for (ChangeNotifier<T> provider : changeNotifiers) { provider.close(); } }
private Set<T> aggregateSet() { if (areAllInitial(changeNotifiers)) { return ChangeNotifiers.initialEmptyDataInstance(); } ImmutableSet.Builder<T> records = ImmutableSet.builder(); for (final ChangeNotifier<T> changeNotifier : changeNotifiers) { records.addAll(changeNotifier.current()); } return records.build(); }