-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made the Function API even more elegant
- Loading branch information
Alexander James Wallar
committed
Jan 21, 2014
1 parent
5c64739
commit edd4564
Showing
4 changed files
with
16 additions
and
22 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
package com.locaudio.functional; | ||
|
||
public abstract class Function<T> { | ||
public abstract void body(T input); | ||
public abstract class Function<T, R> { | ||
public abstract R body(T input); | ||
|
||
public void call(T input) { | ||
body(input); | ||
} | ||
@SuppressWarnings("rawtypes") | ||
public static Function getEmptyFunction() { | ||
return new Function() { | ||
|
||
@Override | ||
public void body(Object input) { | ||
} | ||
|
||
}; | ||
public R call(T input) { | ||
return body(input); | ||
} | ||
} |
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
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