add mapNotNull to ObjIterable with documentation
This commit is contained in:
1 parent
bce88ced43
commit
2737aaa14e
2 files changed
+31
No files matched your search
@@ -68,6 +68,20 @@ These, again, does the thing:
|
||||
|
||||
>>> void
|
||||
|
||||
## map and mapNotNull
|
||||
|
||||
Used to transform either the whole iterable stream or also skipping som elements from it:
|
||||
|
||||
val source = [1,2,3,4]
|
||||
// transform every element to string or null:
|
||||
assertEquals(["n1", "n2", null, "n4"], source.map { if( it == 3 ) null else "n"+it } )
|
||||
|
||||
// transform every element to stirng, skipping 3:
|
||||
assertEquals(["n1", "n2", "n4"], source.mapNotNull { if( it == 3 ) null else "n"+it } )
|
||||
|
||||
>>> void
|
||||
|
||||
|
||||
## Instance methods:
|
||||
|
||||
| fun/method | description |
|
||||
|
||||
Reference in new issue
Block a user