https://kotlinlang.org logo
#exposed
Title
# exposed
j

jvtrigueros

08/10/2017, 2:33 AM
I'm using [ViaTest.kt#L64](https://github.com/JetBrains/Exposed/blob/master/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ViaTest.kt#L64) as reference for creating a DAO. I'm looking at ways to append things to a
SizedIterable
, if we take the test as an example the only way I've been able to do so is to do
n1.connectedStrings.toMutableList().add(x)
. Am I going way off base here?
t

tapac

08/11/2017, 9:36 PM
It wont work, because call of toMutableList() will create new copy of elements from SizedIterable and then you add element to copy which unlinked from dao.
You should use
Copy code
n1.connectedStrings = SizedCollection(n1.connectedStrings.toList() + s2)
instead
j

jvtrigueros

08/12/2017, 2:53 PM
Thank you! This helps, I'm much more familiar with immutable operations, however, I wasn't sure what the underlying SQL were going to be e.g. delete all rows and re-add them vs. only add the ones that didn't already exist.
7 Views