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