329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
# File 'lib/jruby/scala_support.rb', line 329
def from_scala
case self
when Java::jruby.collection.MapWrapper
self.rubyHash
when Java::scala.collection.mutable.Map
JRuby::ScalaSupport::Map::Mutable.new(self)
when Java::scala.collection.Map, Java::scala.collection.immutable.Map
JRuby::ScalaSupport::Map::Immutable.new(self)
when Java::jruby.collection.ListWrapper
self.rubyArray
when Java::scala.collection.mutable.Seq
JRuby::ScalaSupport::Seq::Mutable.new(self)
when Java::scala.collection.Seq, Java::scala.collection.immutable.Seq
JRuby::ScalaSupport::Seq::Immutable.new(self)
when Java::scala.Product
match = self.class.to_s.match(/^Java::Scala::Tuple(\d+)$/)
if match
size = match[1].to_i
JRuby::ScalaSupport::Tuple.new(self, size)
else
self
end
when Java::jruby.collection.SetWrapper
self.rubySet
when Java::scala.collection.mutable.Set
JRuby::ScalaSupport::Set::Mutable.new(self)
when Java::scala.collection.Set, Java::scala.collection.immutable.Set,
JRuby::ScalaSupport::Set::Immutable.new(self)
else
self
end
end
|