17
17
18
18
package pl .project13 .jgit ;
19
19
20
- import static com .google .common .collect .Lists .newArrayList ;
21
- import static com .google .common .collect .Maps .newHashMap ;
22
-
23
20
import java .io .IOException ;
24
21
import java .util .*;
25
22
import java .util .regex .Pattern ;
@@ -108,7 +105,7 @@ public String getClosestTagCommitCount(@NotNull Repository repo, RevCommit headC
108
105
}
109
106
110
107
private Map <ObjectId , List <DatedRevTag >> getClosestTagAsMap (@ NotNull Repository repo ){
111
- Map <ObjectId , List <DatedRevTag >> mapWithClosestTagOnly = newHashMap ();
108
+ Map <ObjectId , List <DatedRevTag >> mapWithClosestTagOnly = new HashMap <> ();
112
109
String matchPattern = ".*" ;
113
110
Map <ObjectId , List <DatedRevTag >> commitIdsToTags = getCommitIdsToTags (repo , true , matchPattern );
114
111
LinkedHashMap <ObjectId , List <DatedRevTag >> sortedCommitIdsToTags = sortByDatedRevTag (commitIdsToTags );
@@ -144,7 +141,7 @@ public int compare(Map.Entry<ObjectId, List<DatedRevTag>> m1, Map.Entry<ObjectId
144
141
}
145
142
146
143
protected Map <ObjectId , List <DatedRevTag >> getCommitIdsToTags (@ NotNull Repository repo , boolean includeLightweightTags , String matchPattern ){
147
- Map <ObjectId , List <DatedRevTag >> commitIdsToTags = newHashMap ();
144
+ Map <ObjectId , List <DatedRevTag >> commitIdsToTags = new HashMap <> ();
148
145
149
146
try (RevWalk walk = new RevWalk (repo )) {
150
147
walk .markStart (walk .parseCommit (repo .resolve ("HEAD" )));
@@ -176,7 +173,7 @@ protected Map<ObjectId, List<DatedRevTag>> getCommitIdsToTags(@NotNull Repositor
176
173
if (commitIdsToTags .containsKey (taggedCommitId )) {
177
174
commitIdsToTags .get (taggedCommitId ).add (new DatedRevTag (revTag ));
178
175
} else {
179
- commitIdsToTags .put (taggedCommitId , newArrayList ( new DatedRevTag (revTag )));
176
+ commitIdsToTags .put (taggedCommitId , new ArrayList <>( Collections . singletonList ( new DatedRevTag (revTag ) )));
180
177
}
181
178
182
179
} catch (IncorrectObjectTypeException ex ) {
@@ -190,7 +187,7 @@ protected Map<ObjectId, List<DatedRevTag>> getCommitIdsToTags(@NotNull Repositor
190
187
if (commitIdsToTags .containsKey (resolvedCommitId )) {
191
188
commitIdsToTags .get (resolvedCommitId ).add (datedRevTag );
192
189
} else {
193
- commitIdsToTags .put (resolvedCommitId , newArrayList ( datedRevTag ));
190
+ commitIdsToTags .put (resolvedCommitId , new ArrayList <>( Collections . singletonList ( datedRevTag ) ));
194
191
}
195
192
}
196
193
} catch (Exception ignored ) {
@@ -214,7 +211,7 @@ private boolean isTagId(ObjectId objectId) {
214
211
}
215
212
216
213
protected HashMap <ObjectId , List <String >> transformRevTagsMapToDateSortedTagNames (Map <ObjectId , List <DatedRevTag >> commitIdsToTags ) {
217
- HashMap <ObjectId , List <String >> commitIdsToTagNames = newHashMap ();
214
+ HashMap <ObjectId , List <String >> commitIdsToTagNames = new HashMap <> ();
218
215
for (Map .Entry <ObjectId , List <DatedRevTag >> objectIdListEntry : commitIdsToTags .entrySet ()) {
219
216
List <String > tagNames = transformRevTagsMapEntryToDateSortedTagNames (objectIdListEntry );
220
217
@@ -226,7 +223,7 @@ protected HashMap<ObjectId, List<String>> transformRevTagsMapToDateSortedTagName
226
223
private List <String > transformRevTagsMapEntryToDateSortedTagNames (Map .Entry <ObjectId , List <DatedRevTag >> objectIdListEntry ) {
227
224
List <DatedRevTag > tags = objectIdListEntry .getValue ();
228
225
229
- List <DatedRevTag > newTags = newArrayList (tags );
226
+ List <DatedRevTag > newTags = new ArrayList <> (tags );
230
227
Collections .sort (newTags , datedRevTagComparator ());
231
228
232
229
List <String > tagNames = Lists .transform (newTags , new Function <DatedRevTag , String >() {
@@ -341,4 +338,4 @@ private void seeAllParents(@NotNull RevWalk revWalk, RevCommit child, @NotNull S
341
338
}
342
339
}
343
340
344
- }
341
+ }
0 commit comments