All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.dagere.peass.vcs.CommitList Maven / Gradle / Ivy

The newest version!
package de.dagere.peass.vcs;

import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class CommitList {
   List commits = new LinkedList<>();

   public List getCommits() {
      return commits;
   }

   public void setCommits(List commits) {
      this.commits = commits;
   }
   
   public void addCommits(List newCommits) {
      Set commitNames = commits.stream().map(commit -> commit.getTag()).collect(Collectors.toSet());
      for (GitCommit newCommit : newCommits) {
         if (!commitNames.contains(newCommit.getTag())) {
            commits.add(newCommit);
         }
      }
   }

   public GitCommit getCommit(String commitName) {
      for (GitCommit commit : commits) {
         if (commit.getTag().equals(commitName)) {
            return commit;
         }
      }
      return null;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy