-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pedro Paulo Amorim
committed
Feb 28, 2016
1 parent
1cebc39
commit e3b3e9a
Showing
3 changed files
with
8 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ public interface IMaybe<A> { | |
boolean isJust(); | ||
boolean isNothing(); | ||
<B> B maybe(B def, Function<B, A> fn); | ||
} | ||
} |
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,11 +1,11 @@ | ||
package com.jmonad.maybe; | ||
|
||
public final class Maybe { | ||
public static <T> IMaybe maybe(T value) { | ||
if (value instanceof IMaybe) { | ||
return (IMaybe) value; | ||
} | ||
public class Maybe { | ||
public static <T> IMaybe<T> maybe(IMaybe<T> value) { | ||
return value; | ||
} | ||
|
||
return value == null ? new Nothing() : new Just<T>(value); | ||
public static <T> IMaybe<T> maybe(T value) { | ||
return value == null ? new Nothing<T>() : new Just<T>(value); | ||
} | ||
} |
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