Created
May 2, 2019 19:24
-
-
Save dglozano/dd02efa15d070c5517c9e62e212ecd24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Event<T> { | |
private boolean hasBeenHandled; | |
private T content; | |
public Event(T content) { | |
this.content = content; | |
this.hasBeenHandled = false; | |
} | |
public boolean hasBeenHandled() { | |
return hasBeenHandled; | |
} | |
public T handleContent() { | |
if(hasBeenHandled) { | |
return null; | |
} else { | |
hasBeenHandled = true; | |
return content; | |
} | |
} | |
public T peekContent() { | |
return content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment