refactored filterNulls() to filterNotNull() which is a clearer name - thanks Stepan!

This commit is contained in:
James Strachan
2012-03-08 14:36:23 +00:00
parent 8d48e3c8a8
commit db72208a91
6 changed files with 21 additions and 16 deletions
@@ -57,10 +57,10 @@ inline fun <T, C: Collection<in T>> Array<T>.filterTo(result: C, predicate: (T)-
}
/** Returns a List containing all the non null elements in this collection */
inline fun <T> Array<T?>?.filterNulls() : Collection<T> = filterNullsTo(java.util.ArrayList<T>())
inline fun <T> Array<T?>?.filterNotNull() : Collection<T> = filterNotNullTo(java.util.ArrayList<T>())
/** Filters all the null elements in this collection winto the given result collection */
inline fun <T, C: Collection<in T>> Array<T?>?.filterNullsTo(result: C) : C {
inline fun <T, C: Collection<in T>> Array<T?>?.filterNotNullTo(result: C) : C {
if (this != null) {
for (elem in this) {
if (elem != null)