File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
composite/src/main/java/com/iluwatar Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * With Composite we can treat tree hierarchies of objects
6+ * with uniform interface (LetterComposite). In this example
7+ * we have sentences composed of words composed of letters.
8+ *
9+ */
310public class App
411{
512 public static void main ( String [] args )
613 {
7-
814 System .out .println ("Message from the orcs: " );
915
1016 LetterComposite orcMessage = new Messenger ().messageFromOrcs ();
@@ -16,6 +22,5 @@ public static void main( String[] args )
1622
1723 LetterComposite elfMessage = new Messenger ().messageFromElves ();
1824 elfMessage .print ();
19-
2025 }
2126}
Original file line number Diff line number Diff line change 33import java .util .ArrayList ;
44import java .util .List ;
55
6+ /**
7+ *
8+ * Composite interface.
9+ *
10+ */
611public abstract class LetterComposite {
712
813 private List <LetterComposite > children = new ArrayList <LetterComposite >();
You can’t perform that action at this time.
0 commit comments