-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.java
More file actions
36 lines (28 loc) · 773 Bytes
/
App.java
File metadata and controls
36 lines (28 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.cbfacademy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{ List <String> fileNamesList = List.of("App.java", "App.txt", null, "App.md");
FileExtension fileExtension = new FileExtension();
Map <String, Integer> FileExtensionMap = new HashMap <>();
Map<String, Integer> resultMap;
for (String fileName : fileNames) {
try {
int result = fileExtension.check(fileName);
resultMap.put(fileName, result);
} catch (CustomException e) {
resultMap.put(fileName, -1);
}
}
for (Map.Entry<String, Integer> entry : resultMap.entrySet()) {
System.out.println(entry.getKey() + " -> " + entry.getValue());
}
}
}