public void sort(Sorter sorter) { synchronized (fChildrenLock) { for (T each : getFilteredChildren()) { sorter.apply(each); } List<T> sortedChildren = new ArrayList<T>(getFilteredChildren()); Collections.sort(sortedChildren, comparator(sorter)); fFilteredChildren = Collections.unmodifiableCollection(sortedChildren); } }
private void sortChild(T child) { fSorter.apply(child); }