Repository: realm/realm-swift
File: Realm/RLMArray.mm (Objective-C++)

Code before:
                                           reason:@"averageOfProperty only supported for int, float and double properties."
                                         userInfo:nil];
    }
}

- (NSString *)JSONString {
    @throw [NSException exceptionWithName:@"RLMNotImplementedException"
                                   reason:@"Not yet implemented" userInfo:nil];
}

- (id)objectAtIndexedSubscript:(NSUInteger)index {
    return [self objectAtIndex:index];
}

- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index {
    [self replaceObjectAtIndex:index withObject:newValue];
}

#pragma mark - Superclass Overrides

- (NSString *)description
{
    NSMutableString *mString = [NSMutableString stringWithString:@"RLMArray (\n"];
    for (RLMObject *object in self) {
        // Indent child objects
        NSString *objDescription = [object.description stringByReplacingOccurrencesOfString:@"\n"
                                                                                 withString:@"\n\t"];
        [mString appendFormat:@"\t%@,\n", objDescription];
    }
    // Remove last comma and newline characters
    [mString deleteCharactersInRange:NSMakeRange(mString.length-2, 2)];
    [mString appendString:@"\n)"];
    
    return [NSString stringWithString:mString];
}

@end


Review comment (suggestion):
That's an interesting consideration. Let's cap it at 1,000 items for now. There are other tools available if our developers need more flexibility than that.


Code after:
                                           reason:@"averageOfProperty only supported for int, float and double properties."
                                         userInfo:nil];
    }
}

- (NSString *)JSONString {
    @throw [NSException exceptionWithName:@"RLMNotImplementedException"
                                   reason:@"Not yet implemented" userInfo:nil];
}

- (id)objectAtIndexedSubscript:(NSUInteger)index {
    return [self objectAtIndex:index];
}

- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index {
    [self replaceObjectAtIndex:index withObject:newValue];
}

#pragma mark - Superclass Overrides

- (NSString *)description
{
    NSMutableString *mString = [NSMutableString stringWithString:@"RLMArray (\n"];
    NSUInteger index = 0;
    NSUInteger skippedObjects = 0;
    for (RLMObject *object in self) {
        // Only display the first 1000 objects
        if (index == 1000) {
            skippedObjects = [self count] - 1000;
            break;
        }
        
        // Indent child objects
        NSString *objDescription = [object.description stringByReplacingOccurrencesOfString:@"\n"
                                                                                 withString:@"\n\t"];
        [mString appendFormat:@"\t[%lu] %@,\n", (unsigned long)index, objDescription];
        index++;
    }
    // Remove last comma and newline characters
    [mString deleteCharactersInRange:NSMakeRange(mString.length-2, 2)];
    if (skippedObjects > 0) {
        [mString appendFormat:@"\n\t... %lu objects skipped.", (unsigned long)skippedObjects];
    }
    [mString appendFormat:@"\n)"];
    return [NSString stringWithString:mString];
}

@end