All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jruby.java.java_8.rb Maven / Gradle / Ivy

There is a newer version: 9.4.12.0
Show newest version
# Extensions for Java 8

# @private shall be moved to Java when compiling against Java 8
org.jruby.RubyEnumerator.class_eval do

  def stream(parallel = false)
    java.util.stream.StreamSupport.stream spliterator, parallel
  end

  def spliterator(mod = nil)
    size = self.size
    # mod = java.util.Spliterator::NONNULL
    # we do not have ArrayNexter detection - assume immutable
    mod ||= java.util.Spliterator::IMMUTABLE
    mod ||= java.util.Spliterator::SIZED if size >= 0
    java.util.Spliterators.spliterator(self, size, mod)
  end

end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy