-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
30 lines (24 loc) · 741 Bytes
/
Copy pathmain.java
File metadata and controls
30 lines (24 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Arrays;
import java.util.List;
import Concretes.ConcreteElementA;
import Concretes.ConcreteElementB;
import Concretes.ConcreteVisitor1;
import Concretes.ConcreteVisitor2;
import Interfaces.Visitor;
/**
* @author: Ly Tran Vinh
* @contact: [email protected]
* @content: Vistor Pattern
*/
import Interfaces.*;
public class main {
public static void main(String[] args) {
List<Element> elements = Arrays.asList(new ConcreteElementA(), new ConcreteElementB());
Visitor visitor1 = new ConcreteVisitor1();
Visitor visitor2 = new ConcreteVisitor2();
for (Element element : elements) {
element.accept(visitor1);
element.accept(visitor2);
}
}
}