intprog_hackery/functional_functions.rb

9 lines
297 B
Ruby

def func_find_all(container_obj, attribute, filter_by)
filters = filter_by.map do |x|
"s.get#{attribute}() #{x.comparator} #{x.value}"
end
# TODO: Consider also having an "or" here
"return #{container_obj}.stream().filter(s -> #{filters.join "&&"}).collect(Collectors.toList());"
end