Files
LABS_EDUCATION/lr11/task_1/e10.java
2026-04-07 21:23:41 +05:00

23 lines
659 B
Java

package lr11.task_1;
import java.util.List;
import java.util.stream.Collectors;
public class e10 {
public static List<Integer> filterLessThan(List<Integer> numbers, int threshold) {
return numbers.stream()
.filter(n -> n < threshold)
.collect(Collectors.toList());
}
public static void main(String[] args) {
List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
int threshold = 5;
List<Integer> result = filterLessThan(numbers, threshold);
System.out.println("Числа, меньше " + threshold + ":");
result.forEach(System.out::println);
}
}