@Test public void appendDependencyPackage() { Header header = new Header(); header.appendDependencyPackage("demo.b"); header.appendDependencyPackage("demo.a"); List<String> dependencyPackageList = header.getDependencyPackageList(); assertEquals(2, dependencyPackageList.size()); assertEquals("demo.a", dependencyPackageList.get(0)); assertEquals("demo.b", dependencyPackageList.get(1)); }
public void appendDependencyPackage(String dependencyPackageName) { if (this.existDependencySet.contains(dependencyPackageName)) { return; } this.existDependencySet.add(dependencyPackageName); List<String> arrayList = this.getDependencyPackageList(); arrayList.add(dependencyPackageName); arrayList.sort(String::compareTo); this.setDependencyPackageList(arrayList); }
Header { public void appendDependencyPackage(String dependencyPackageName) { if (this.existDependencySet.contains(dependencyPackageName)) { return; } this.existDependencySet.add(dependencyPackageName); List<String> arrayList = this.getDependencyPackageList(); arrayList.add(dependencyPackageName); arrayList.sort(String::compareTo); this.setDependencyPackageList(arrayList); } }
Header { public void appendDependencyPackage(String dependencyPackageName) { if (this.existDependencySet.contains(dependencyPackageName)) { return; } this.existDependencySet.add(dependencyPackageName); List<String> arrayList = this.getDependencyPackageList(); arrayList.add(dependencyPackageName); arrayList.sort(String::compareTo); this.setDependencyPackageList(arrayList); } Header(); }
Header { public void appendDependencyPackage(String dependencyPackageName) { if (this.existDependencySet.contains(dependencyPackageName)) { return; } this.existDependencySet.add(dependencyPackageName); List<String> arrayList = this.getDependencyPackageList(); arrayList.add(dependencyPackageName); arrayList.sort(String::compareTo); this.setDependencyPackageList(arrayList); } Header(); void appendDependencyPackage(String dependencyPackageName); void appendDependencyPackageList(List<String> dependencyPackageList); List<String> getDependencyPackageList(); void setDependencyPackageList(List<String> dependencyPackageList); }
Header { public void appendDependencyPackage(String dependencyPackageName) { if (this.existDependencySet.contains(dependencyPackageName)) { return; } this.existDependencySet.add(dependencyPackageName); List<String> arrayList = this.getDependencyPackageList(); arrayList.add(dependencyPackageName); arrayList.sort(String::compareTo); this.setDependencyPackageList(arrayList); } Header(); void appendDependencyPackage(String dependencyPackageName); void appendDependencyPackageList(List<String> dependencyPackageList); List<String> getDependencyPackageList(); void setDependencyPackageList(List<String> dependencyPackageList);  }