mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
More use of Visitor pattern - allowing iteration over all cards in the game without allocating a temporary collection.
This commit is contained in:
11
forge-core/src/main/java/forge/util/Visitor.java
Normal file
11
forge-core/src/main/java/forge/util/Visitor.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package forge.util;
|
||||
|
||||
public abstract class Visitor<T> {
|
||||
public abstract void visit(T object);
|
||||
|
||||
public void visitAll(Iterable<? extends T> objects) {
|
||||
for (T obj : objects) {
|
||||
visit(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user