Skip to content

Instantly share code, notes, and snippets.

@LeifWarner
Created October 19, 2012 21:59
Show Gist options
  • Save LeifWarner/3920972 to your computer and use it in GitHub Desktop.
Save LeifWarner/3920972 to your computer and use it in GitHub Desktop.
module Java::ScalaCollection::TraversableOnce
include Enumerable
def each(&f)
foreach(f)
end
# Cribbed from
# https://github.com/scala/scala/blob/v2.9.2/src/library/scala/collection/TraversableOnce.scala#L231
def to_a
result = java.lang.Object[length].new
copyToArray(result, 0)
result.to_a
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment