是否需要将.ballerina提交到版本控制

时间:2019-03-01 01:10:08

标签: version-control project ballerina

使用existingList在工作目录中创建一个package collection.delta.model; import java.util.List; import java.util.Objects; import org.apache.commons.lang3.StringUtils; package collection.delta.model; import java.util.List; import java.util.Objects; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; public class A { private String aName; private List<B> bList; public String getaName() { return aName; } public void setaName(String aName) { this.aName = aName; } public List<B> getbList() { return bList; } public void setbList(List<B> bList) { this.bList = bList; } public A(String name, List<B> bList) { this.aName = name; this.bList = bList; } @Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof A)) { return false; } A b = (A) o; return StringUtils.isNotBlank(aName) && StringUtils.equalsAnyIgnoreCase(b.getaName(), aName) && CollectionUtils.disjunction(this.getbList(), b.getbList()).isEmpty(); } @Override public int hashCode() { if (StringUtils.isBlank(aName)) { return 31; } return Objects.hashCode(aName); } package collection.delta.model; import java.util.Objects; import org.apache.commons.lang3.StringUtils; public class B { private String bName; public String getbName() { return bName; } public void setbName(String bName) { this.bName = bName; } public B(String name) { this.bName = name; } @Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof B)) { return false; } B b = (B) o; return StringUtils.isNotBlank(bName) && StringUtils.equalsAnyIgnoreCase(b.getbName(), bName); } @Override public int hashCode() { if (StringUtils.isBlank(bName)) { return 31; } return Objects.hashCode(bName); } } package collection.delta; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import collection.delta.model.A; import collection.delta.model.B; public class App { public static void main( String[] args ) { List<A> originalA = new ArrayList<A>(); List<A> newA = new ArrayList<A>(); List<B> bListOriginalA1 = new ArrayList<B>(); bListOriginalA1.add(new B("originalA1_B1")); bListOriginalA1.add(new B("originalA1_B2")); bListOriginalA1.add(new B("originalA1_B3")); bListOriginalA1.add(new B("originalA1_B4")); A originalA1 = new A("originalA1", bListOriginalA1); List<B> bListOriginalA2 = new ArrayList<B>(); bListOriginalA2.add(new B("originalA2_B1")); bListOriginalA2.add(new B("originalA2_B2")); bListOriginalA2.add(new B("originalA2_B3")); bListOriginalA2.add(new B("originalA2_B4")); A originalA2 = new A("originalA2", bListOriginalA2); List<B> bListOriginalA3 = new ArrayList<B>(); bListOriginalA3.add(new B("originalA3_B1")); bListOriginalA3.add(new B("originalA3_B2")); bListOriginalA3.add(new B("originalA3_B3")); bListOriginalA3.add(new B("originalA3_B4")); A originalA3 = new A("originalA3", bListOriginalA3); originalA.add(originalA1); originalA.add(originalA2); originalA.add(originalA3); List<B> bListNewA1 = new ArrayList<B>(); bListNewA1.add(new B("originalA1_B1")); bListNewA1.add(new B("originalA1_B2")); bListNewA1.add(new B("originalA1_B3")); bListNewA1.add(new B("originalA1_B4")); A newA1 = new A("originalA1", bListNewA1); List<B> bListNewA2 = new ArrayList<B>(); bListNewA2.add(new B("originalA2_B1")); bListNewA2.add(new B("originalA2_B2")); bListNewA2.add(new B("originalA2_B3")); bListNewA2.add(new B("originalA2_B4")); A newA2 = new A("originalA2", bListNewA2); List<B> bListNewA3 = new ArrayList<B>(); bListNewA3.add(new B("originalA3_B1")); bListNewA3.add(new B("originalA3_B2")); bListNewA3.add(new B("originalA3_B5")); bListNewA3.add(new B("originalA3_B4")); A newA3 = new A("originalA3", bListNewA3); List<B> bListNewA4 = new ArrayList<B>(); bListNewA4.add(new B("A4_B1")); bListNewA4.add(new B("A4_B2")); bListNewA4.add(new B("A4_B3")); bListNewA4.add(new B("A4_B4")); A newA4 = new A("originalA4", bListNewA4); newA.add(newA1); newA.add(newA2); newA.add(newA3); newA.add(newA4); List<A> result = CollectionUtils.disjunction(originalA, newA).stream().collect(Collectors.toList()); for (A a : newA) { for (A aResult : result) { if (StringUtils.equalsAnyIgnoreCase(a.getaName(), aResult.getaName())) { originalA.add(aResult); } } } System.out.println(""); } } 目录。

是否需要提交目录内的内容才能在git之类的版本控制环境中共享项目?

1 个答案:

答案 0 :(得分:1)

提交.ballerina目录和Ballerina.toml文件可以使第二个签出您的存储库的人将代码用作芭蕾舞演员项目,而无需自己进行芭蕾舞演员自身的初始化。因此,我认为最好提交这些内容,但是我认为您不需要提交.ballerina目录的内容。