diff options
Diffstat (limited to 'VKPC/NSMutableArray+QueueAdditions.m')
-rw-r--r-- | VKPC/NSMutableArray+QueueAdditions.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/VKPC/NSMutableArray+QueueAdditions.m b/VKPC/NSMutableArray+QueueAdditions.m new file mode 100644 index 0000000..2d5a35d --- /dev/null +++ b/VKPC/NSMutableArray+QueueAdditions.m @@ -0,0 +1,25 @@ +// +// NSMutableArray+QueueAdditions.m +// VKPC +// +// Created by Eugene on 12/3/13. +// Copyright (c) 2013 Eugene Z. All rights reserved. +// + +#import "NSMutableArray+QueueAdditions.h" + +@implementation NSMutableArray (QueueAdditions) + +- (id) dequeue { + id headObject = [self objectAtIndex:0]; + if (headObject != nil) { + [self removeObjectAtIndex:0]; + } + return headObject; +} + +- (void) enqueue:(id)anObject { + [self addObject:anObject]; +} + +@end
\ No newline at end of file |