Option.h 547 B

1234567891011121314151617181920212223242526
  1. #import <Foundation/Foundation.h>
  2. #import "Mappable.h"
  3. #import "Foldable.h"
  4. #import "Enumerable.h"
  5. #import "Flattenable.h"
  6. @class Sequence;
  7. @interface Option : NSObject <NSCopying, Mappable, Foldable, Enumerable, Flattenable>
  8. -(BOOL)isEmpty;
  9. -(id)get;
  10. - (id)getSafely;
  11. -(id)getOrElse:(id)other;
  12. -(id)getOrInvoke:(id (^)())funcBlock;
  13. - (id)flatMap:(id (^)(id))funcBlock;
  14. -(Sequence *)asSequence;
  15. - (void)maybe:(void (^)(id))invokeWhenSomeBlock;
  16. +(id)option:(id)value;
  17. @end
  18. static Option* option(id value) {
  19. return [Option option:value];
  20. }