groostav
04/18/2018, 9:48 PMinterface MyFortranCode: com.sun.jna.Library {
fun start(featureIndex: Int): Boolean
fun end(featureIndex: Int): Boolean
companion object: MyFortranCode by LibraryLoader.load<MyFortranCode>()
}
too much magic?groostav
04/18/2018, 9:51 PMgroostav
04/18/2018, 9:52 PMgroostav
04/18/2018, 9:52 PMcompanion object by lazy { LibLoader.load<...>() }
?groostav
04/18/2018, 9:53 PMgroostav
04/18/2018, 9:53 PMgroostav
04/18/2018, 9:55 PMcompanion object: Something by somethingelse
is pretty powerful thoughwei
04/18/2018, 11:56 PMval myList = List<MyClass>(...)
myList.filter(it.date > cutoffDate)
.filter(it.type != "excludedType")
.forEach {
// process the subset that went through the filters
...
}
For those elements that got filtered out in the above example, I also want to log them (say by sending a message to an outside listener to ack that I got this element but it failed the filter). How do I do that in an idiomatic way?adam-mcneilly
04/18/2018, 11:58 PM.filter {
val conditionMet = it.type != "excludedType"
if (!conditionMet) log()
conditionMet
}
dknapp
04/18/2018, 11:59 PMdknapp
04/19/2018, 12:00 AMadam-mcneilly
04/19/2018, 12:02 AMfilterOrLog()
extension method that does what I put above, but honestly if this is your only use case I think it's okay.Joel Armstrong
04/19/2018, 2:08 AMsuhas
04/19/2018, 3:42 AMuser
04/19/2018, 8:54 AMuser
04/19/2018, 8:55 AMuser
04/19/2018, 8:56 AMuser
04/19/2018, 9:02 AMuser
04/19/2018, 9:05 AMDaniel Tam
04/19/2018, 12:47 PMhho
04/19/2018, 12:50 PMConcurrentModificationException
at some point…Daniel Tam
04/19/2018, 1:10 PMmarstran
04/19/2018, 1:14 PMChannel
.iex
04/19/2018, 1:21 PMiex
04/19/2018, 1:21 PMConcurrentModificationException
- do I have to use iterator?diesieben07
04/19/2018, 1:22 PMIterator
if you want to remove while iterating.iex
04/19/2018, 1:23 PMandyb
04/19/2018, 1:27 PMtest
value is handled?Daniel Tam
04/19/2018, 1:27 PMactor
@marstrandiesieben07
04/19/2018, 1:44 PM