Hi there, I'm having a problem with stream. Consid...
# serialization
h
Hi there, I'm having a problem with stream. Consider the following example
Copy code
val q: Queue<String> = PriorityQueue { o1, o2 ->
    compareValuesBy(
        o1,
        o2,
        { it.length },
        { it.last() })
}


q.add("foo")

val xstream = XStream()
val envXML = xstream.toXML(q)
println(envXML)
This results in
Copy code
<java.util.PriorityQueue serialization="custom">
  <unserializable-parents/>
  <java.util.PriorityQueue>
    <default>
      <size>1</size>
      <comparator class="null"/>
    </default>
    <int>2</int>
    <string>foo</string>
  </java.util.PriorityQueue>
</java.util.PriorityQueue>
So it seems that the kotlin comparator could not be serialized. Do you guys know any workaround to include the custom comparator into the XML?