lr11 -> task_1 -> e5-10

This commit is contained in:
2026-04-07 21:23:41 +05:00
parent 1d32229ad9
commit 8c963da142
6 changed files with 131 additions and 0 deletions

21
lr11/task_1/e9.java Normal file
View File

@@ -0,0 +1,21 @@
package lr11.task_1;
import java.util.List;
import java.util.stream.Collectors;
public class e9 {
public static List<String> filterOnlyLetters(List<String> strings) {
return strings.stream()
.filter(s -> s.chars().allMatch(Character::isLetter))
.collect(Collectors.toList());
}
public static void main(String[] args) {
List<String> stringList = List.of("dfgdfgfd", "fdg54tger", "34fww33", "dsfdsfsdf");
List<String> result = filterOnlyLetters(stringList);
System.out.println("Строки, содержащие только буквы:");
result.forEach(System.out::println);
}
}