1717
1818package pl .project13 .jgit ;
1919
20- import static com .google .common .collect .Lists .newArrayList ;
21- import static com .google .common .collect .Maps .newHashMap ;
22-
2320import java .io .IOException ;
2421import java .util .*;
2522import java .util .regex .Pattern ;
@@ -108,7 +105,7 @@ public String getClosestTagCommitCount(@NotNull Repository repo, RevCommit headC
108105 }
109106
110107 private Map <ObjectId , List <DatedRevTag >> getClosestTagAsMap (@ NotNull Repository repo ){
111- Map <ObjectId , List <DatedRevTag >> mapWithClosestTagOnly = newHashMap ();
108+ Map <ObjectId , List <DatedRevTag >> mapWithClosestTagOnly = new HashMap <> ();
112109 String matchPattern = ".*" ;
113110 Map <ObjectId , List <DatedRevTag >> commitIdsToTags = getCommitIdsToTags (repo , true , matchPattern );
114111 LinkedHashMap <ObjectId , List <DatedRevTag >> sortedCommitIdsToTags = sortByDatedRevTag (commitIdsToTags );
@@ -144,7 +141,7 @@ public int compare(Map.Entry<ObjectId, List<DatedRevTag>> m1, Map.Entry<ObjectId
144141 }
145142
146143 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 <> ();
148145
149146 try (RevWalk walk = new RevWalk (repo )) {
150147 walk .markStart (walk .parseCommit (repo .resolve ("HEAD" )));
@@ -176,7 +173,7 @@ protected Map<ObjectId, List<DatedRevTag>> getCommitIdsToTags(@NotNull Repositor
176173 if (commitIdsToTags .containsKey (taggedCommitId )) {
177174 commitIdsToTags .get (taggedCommitId ).add (new DatedRevTag (revTag ));
178175 } else {
179- commitIdsToTags .put (taggedCommitId , newArrayList ( new DatedRevTag (revTag )));
176+ commitIdsToTags .put (taggedCommitId , new ArrayList <>( Collections . singletonList ( new DatedRevTag (revTag ) )));
180177 }
181178
182179 } catch (IncorrectObjectTypeException ex ) {
@@ -190,7 +187,7 @@ protected Map<ObjectId, List<DatedRevTag>> getCommitIdsToTags(@NotNull Repositor
190187 if (commitIdsToTags .containsKey (resolvedCommitId )) {
191188 commitIdsToTags .get (resolvedCommitId ).add (datedRevTag );
192189 } else {
193- commitIdsToTags .put (resolvedCommitId , newArrayList ( datedRevTag ));
190+ commitIdsToTags .put (resolvedCommitId , new ArrayList <>( Collections . singletonList ( datedRevTag ) ));
194191 }
195192 }
196193 } catch (Exception ignored ) {
@@ -214,7 +211,7 @@ private boolean isTagId(ObjectId objectId) {
214211 }
215212
216213 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 <> ();
218215 for (Map .Entry <ObjectId , List <DatedRevTag >> objectIdListEntry : commitIdsToTags .entrySet ()) {
219216 List <String > tagNames = transformRevTagsMapEntryToDateSortedTagNames (objectIdListEntry );
220217
@@ -226,7 +223,7 @@ protected HashMap<ObjectId, List<String>> transformRevTagsMapToDateSortedTagName
226223 private List <String > transformRevTagsMapEntryToDateSortedTagNames (Map .Entry <ObjectId , List <DatedRevTag >> objectIdListEntry ) {
227224 List <DatedRevTag > tags = objectIdListEntry .getValue ();
228225
229- List <DatedRevTag > newTags = newArrayList (tags );
226+ List <DatedRevTag > newTags = new ArrayList <> (tags );
230227 Collections .sort (newTags , datedRevTagComparator ());
231228
232229 List <String > tagNames = Lists .transform (newTags , new Function <DatedRevTag , String >() {
@@ -341,4 +338,4 @@ private void seeAllParents(@NotNull RevWalk revWalk, RevCommit child, @NotNull S
341338 }
342339 }
343340
344- }
341+ }
0 commit comments