List.metaClass.avg = {
return delegate.size() ? delegate.sum() / delegate.size() : 0
}
Use:
assert [1, 2, 3].avg() == 2
List.metaClass.avg = {
return delegate.size() ? delegate.sum() / delegate.size() : 0
}
Use:
assert [1, 2, 3].avg() == 2
For further actions, you may consider blocking this person and/or reporting abuse
Jakub Bobkowski -
Abhishek Maurya -
Huynh Thanh Phuc -
Ayush Thakur -
Top comments (0)