Like fighting with the tiped one of JAVA
The problem is to implement a Observer pattern with two types of “dependents” that do not have anything to do to each other, the only thing that they share is a update() method . I am going to show it graphically, maybe you understand what am I talking about:
Code:
|--------------| |--------------------| |--------------|
| Observer1 | | Model | | Observer2 |
|--------------| |--------------------| |--------------|
| |<--------- |dependents:ArrayList| --->| |
|--------------| |--------------------| |--------------|
|update():void | | changed():void | |update():void |
|--------------| |--------------------| |--------------|
Code:
public void changed(){
Iterator it=dependents.iterator();
while(ir.hasNext()){
______ object = (______) it.next();
object.update();
}
}
any ideas? I want the solution without making 2 differents arrays.
Albert:rolleyes:
RE: Like fighting with the tiped one of JAVA