3
3
import java .io .InputStreamReader ;
4
4
import java .util .ArrayList ;
5
5
import java .util .HashMap ;
6
+ import java .util .HashSet ;
6
7
import java .util .Map ;
8
+ import java .util .Set ;
7
9
8
10
public class MissingBlobs {
9
11
@@ -20,10 +22,9 @@ public class MissingBlobs {
20
22
private HashMap <String , ArrayList <Blob >> dependencyBlobs ;
21
23
22
24
/*
23
- * Key: Name of missing blob dependency
24
- * Value: Null (unused)
25
+ * Value: Name of missing blob dependency
25
26
*/
26
- private HashMap < String , String > missingBlobs ;
27
+ private Set < String > missingBlobs ;
27
28
28
29
private String expandArrayList (ArrayList <Blob > arr ) {
29
30
StringBuilder expanded = new StringBuilder ();
@@ -103,21 +104,20 @@ public void addBlobDir(String blobPath) {
103
104
}
104
105
105
106
public void updateMissingBlobs () {
106
- missingBlobs = new HashMap < String , String >();
107
+ missingBlobs = new HashSet < String >();
107
108
108
109
for (Map .Entry <String , ArrayList <Blob >> blob : dependencyBlobs .entrySet ()) {
109
110
String dependencyName = blob .getKey ();
110
111
111
- if (missingBlobs .containsKey (dependencyName ) || presentBlobs .containsKey (dependencyName ))
112
+ if (missingBlobs .contains (dependencyName ) || presentBlobs .containsKey (dependencyName ))
112
113
continue ;
113
114
114
- missingBlobs .put (dependencyName , null );
115
+ missingBlobs .add (dependencyName );
115
116
}
116
117
}
117
118
118
119
public void showMissingBlobs () {
119
- for (Map .Entry <String , String > blob : missingBlobs .entrySet ()) {
120
- String dependencyName = blob .getKey ();
120
+ for (String dependencyName : missingBlobs ) {
121
121
ArrayList <Blob > blobsWithDependencies = dependencyBlobs .get (dependencyName );
122
122
System .out .println (dependencyName + " required by: " + expandArrayList (blobsWithDependencies ));
123
123
}
0 commit comments