Skip to content

Instantly share code, notes, and snippets.

@walidum
Created September 19, 2023 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walidum/4bc5e1e3cd42fc9cd6e8d1a10d35c4fd to your computer and use it in GitHub Desktop.
Save walidum/4bc5e1e3cd42fc9cd6e8d1a10d35c4fd to your computer and use it in GitHub Desktop.
import java.util.*;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
List<String> matrix = List.of(
"******c********",
"*6****o********",
"******d********",
"******i********",
"***********n***",
"******g********",
"*9****g*a******",
"***************",
"******m********",
"******e********");
String result = matrix.stream()
.map(s -> extract(s))
.collect(Collectors.joining());
System.out.println();
}
private static String extract(String s){
if (s==null) return "";
return Arrays.stream(s.split(""))
.filter(s1 -> s1.charAt(0)>96 && s1.charAt(0)<123 )
.collect(Collectors.joining());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment