forked from sumeet-automation/selenium-java-interview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion39.java
More file actions
23 lines (19 loc) · 704 Bytes
/
Copy pathQuestion39.java
File metadata and controls
23 lines (19 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package string;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
public class Question39 {
public static void main(String[] args) {
String word = "ABCD";
Stream.of(word.split("")).forEach(letter-> System.out.printf(getNextAlphabet(letter)));
}
private static String getNextAlphabet(String letter) {
int index = getAlphabetsList().indexOf(letter);
return getAlphabetsList().get(index + 1);
}
private static List<String> getAlphabetsList() {
return List.of("A","B","C","D","E","F","G","H","I","J",
"K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
}
}