private static Set < GroupName > calculateNames ( TimeSeriesCollection current , Collection < TimeSeriesCollection > backward , Collection < TimeSeriesCollection > forward ) { final Set < GroupName > names = backward . stream ( ) . flatMap ( tsc -> tsc . getGroups ( x -> true ) . stream ( ) ) . collect ( Collectors . toCollection ( THashSet :: new ) ) ; names . retainAll ( forward . stream ( ) . flatMap ( tsc -> tsc . getGroups ( x -> true ) . stream ( ) ) . collect ( Collectors . toSet ( ) ) ) ; names . removeAll ( current . getGroups ( x -> true ) ) ; return names ; }
Calculate all names that can be interpolated . The returned set will not have any names present in the current collection .