mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 18:59:21 +00:00
added composite sample
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.iluwatar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Sentence extends LetterComposite {
|
||||
|
||||
public Sentence(List<Word> words) {
|
||||
for (Word w: words) {
|
||||
this.add(w);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void printThisBefore() {
|
||||
// nop
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void printThisAfter() {
|
||||
System.out.print(".");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user