Skip to content

Commit 38a94f9

Browse files
committed
removed newCollection methods as irrelevant for Java 7
1 parent 4274dfc commit 38a94f9

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/main/java/pl/project13/jgit/JGitCommon.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,7 @@
2121
import static com.google.common.collect.Maps.newHashMap;
2222

2323
import java.io.IOException;
24-
import java.util.Collection;
25-
import java.util.Collections;
26-
import java.util.Comparator;
27-
import java.util.HashMap;
28-
import java.util.LinkedHashMap;
29-
import java.util.LinkedList;
30-
import java.util.List;
31-
import java.util.Map;
32-
import java.util.Queue;
33-
import java.util.Set;
24+
import java.util.*;
3425
import java.util.regex.Pattern;
3526

3627
import org.apache.maven.plugin.Mojo;
@@ -53,9 +44,6 @@
5344
import com.google.common.collect.Collections2;
5445
import com.google.common.collect.Lists;
5546

56-
import static com.google.common.collect.Lists.newLinkedList;
57-
import static com.google.common.collect.Sets.newHashSet;
58-
5947
public class JGitCommon {
6048
public Collection<String> getTags(Repository repo, final ObjectId headId) throws GitAPIException{
6149
RevWalk walk = null;
@@ -119,7 +107,7 @@ private Map<ObjectId, List<DatedRevTag>> getClosestTagAsMap(@NotNull Repository
119107
Map<ObjectId, List<DatedRevTag>> commitIdsToTags = getCommitIdsToTags(repo, includeLightweightTags, matchPattern, mojo);
120108
LinkedHashMap<ObjectId, List<DatedRevTag>> sortedCommitIdsToTags = sortByDatedRevTag(commitIdsToTags);
121109

122-
for(Map.Entry<ObjectId, List<DatedRevTag>> entry: sortedCommitIdsToTags.entrySet()){
110+
for (Map.Entry<ObjectId, List<DatedRevTag>> entry: sortedCommitIdsToTags.entrySet()){
123111
mapWithClosestTagOnly.put(entry.getKey(), entry.getValue());
124112
break;
125113
}
@@ -128,7 +116,7 @@ private Map<ObjectId, List<DatedRevTag>> getClosestTagAsMap(@NotNull Repository
128116
}
129117

130118
private LinkedHashMap<ObjectId, List<DatedRevTag>> sortByDatedRevTag(Map<ObjectId, List<DatedRevTag>> map) {
131-
List<Map.Entry<ObjectId, List<DatedRevTag>>> list = new LinkedList<>(map.entrySet());
119+
List<Map.Entry<ObjectId, List<DatedRevTag>>> list = new ArrayList<>(map.entrySet());
132120

133121
Collections.sort(list, new Comparator<Map.Entry<ObjectId, List<DatedRevTag>>>() {
134122
public int compare(Map.Entry<ObjectId, List<DatedRevTag>> m1, Map.Entry<ObjectId, List<DatedRevTag>> m2) {
@@ -288,9 +276,9 @@ protected int distanceBetween(@NotNull Repository repo, @NotNull RevCommit child
288276
try (RevWalk revWalk = new RevWalk(repo)) {
289277
revWalk.markStart(child);
290278

291-
Set<ObjectId> seena = newHashSet();
292-
Set<ObjectId> seenb = newHashSet();
293-
Queue<RevCommit> q = newLinkedList();
279+
Set<ObjectId> seena = new HashSet<>();
280+
Set<ObjectId> seenb = new HashSet<>();
281+
Queue<RevCommit> q = new ArrayDeque<>();
294282

295283
q.add(revWalk.parseCommit(child));
296284
int distance = 0;
@@ -332,7 +320,7 @@ protected int distanceBetween(@NotNull Repository repo, @NotNull RevCommit child
332320
}
333321

334322
private void seeAllParents(@NotNull RevWalk revWalk, RevCommit child, @NotNull Set<ObjectId> seen) throws IOException {
335-
Queue<RevCommit> q = newLinkedList();
323+
Queue<RevCommit> q = new ArrayDeque<>();
336324
q.add(child);
337325

338326
while (q.size() > 0) {

0 commit comments

Comments
 (0)