11package com .dkaedv .glghproxy .converter ;
22
3+ import java .util .ArrayList ;
34import java .util .HashMap ;
45import java .util .List ;
5- import java .util .Vector ;
66
77import org .apache .commons .lang3 .StringUtils ;
88import org .apache .commons .logging .Log ;
@@ -49,7 +49,7 @@ public static RepositoryBranch convertBranch(GitlabBranch glbranch) {
4949 }
5050
5151 public static List <RepositoryBranch > convertBranches (List <GitlabBranch > glbranches ) {
52- List <RepositoryBranch > branches = new Vector < RepositoryBranch >( );
52+ List <RepositoryBranch > branches = new ArrayList <>( glbranches . size () );
5353
5454 for (GitlabBranch glbranch : glbranches ) {
5555 RepositoryBranch branch = convertBranch (glbranch );
@@ -81,9 +81,10 @@ public static RepositoryCommit convertCommit(GitlabCommit glcommit, List<GitlabC
8181 repoCommit .setAuthor (user );
8282 repoCommit .setCommitter (user );
8383
84- if (glcommit .getParentIds () != null ) {
85- List <Commit > parents = new Vector <Commit >();
86- for (String parentSha : glcommit .getParentIds ()) {
84+ List <String > parentIds = glcommit .getParentIds ();
85+ if (parentIds != null ) {
86+ List <Commit > parents = new ArrayList <>(parentIds .size ());
87+ for (String parentSha : parentIds ) {
8788 Commit parent = new Commit ();
8889 parent .setSha (parentSha );
8990 parents .add (parent );
@@ -92,7 +93,7 @@ public static RepositoryCommit convertCommit(GitlabCommit glcommit, List<GitlabC
9293 }
9394
9495 if (gldiffs != null ) {
95- List <CommitFile > files = new Vector < CommitFile >( );
96+ List <CommitFile > files = new ArrayList <>( gldiffs . size () );
9697 for (GitlabCommitDiff diff : gldiffs ) {
9798 convertCommitFile (files , diff );
9899 }
@@ -159,7 +160,7 @@ public static Repository convertRepository(GitlabProject project) {
159160 }
160161
161162 public static List <Repository > convertRepositories (List <GitlabProject > projects ) {
162- List <Repository > repos = new Vector < Repository >( );
163+ List <Repository > repos = new ArrayList <>( projects . size () );
163164
164165 for (GitlabProject project : projects ) {
165166 repos .add (convertRepository (project ));
@@ -169,7 +170,7 @@ public static List<Repository> convertRepositories(List<GitlabProject> projects)
169170 }
170171
171172 public static List <PullRequest > convertMergeRequests (List <GitlabMergeRequest > glmergerequests , String gitlabUrl , String namespace , String repo ) {
172- List <PullRequest > pulls = new Vector < PullRequest >( );
173+ List <PullRequest > pulls = new ArrayList <>( glmergerequests . size () );
173174
174175 for (GitlabMergeRequest glmr : glmergerequests ) {
175176 pulls .add (convertMergeRequest (glmr , gitlabUrl , namespace , repo ));
@@ -282,7 +283,7 @@ public static User convertUser(GitlabUser gluser) {
282283 }
283284
284285 public static List <RepositoryCommit > convertCommits (List <GitlabCommit > glcommits ) {
285- List <RepositoryCommit > commits = new Vector < RepositoryCommit >( );
286+ List <RepositoryCommit > commits = new ArrayList <>( glcommits . size () );
286287
287288 for (GitlabCommit glcommit : glcommits ) {
288289 commits .add (convertCommit (glcommit , null , null ));
@@ -292,7 +293,7 @@ public static List<RepositoryCommit> convertCommits(List<GitlabCommit> glcommits
292293 }
293294
294295 public static List <Comment > convertComments (List <GitlabNote > glnotes ) {
295- List <Comment > comments = new Vector < Comment >( );
296+ List <Comment > comments = new ArrayList <>( glnotes . size () );
296297
297298 for (GitlabNote glnote : glnotes ) {
298299 comments .add (convertComment (glnote ));
@@ -313,7 +314,7 @@ private static Comment convertComment(GitlabNote glnote) {
313314 }
314315
315316 public static List <RepositoryHook > convertHooks (List <GitlabProjectHook > glhooks ) {
316- List <RepositoryHook > hooks = new Vector < RepositoryHook >( );
317+ List <RepositoryHook > hooks = new ArrayList <>( glhooks . size () );
317318
318319 for (GitlabProjectHook glhook : glhooks ) {
319320 hooks .add (convertHook (glhook ));
0 commit comments