CHAPTER 7

image

Collections

In this chapter, you will learn:

  • What arrays in Nashorn are
  • How to create arrays in Nashorn using array literals and the Array object
  • How to use different methods of the Array object
  • How to work with array-like objects
  • How to create and use typed arrays in Nashorn
  • How to use Java collections in Nashorn
  • How to create Java arrays in Nashorn
  • How to convert Java arrays to Nashorn arrays and vice versa

What Is an Array in Nashorn?

An array in Nashorn is a specialized object, called an Array object, which is used to represent an ordered collection of values. An Array object treats certain property names in a special way. If a ...

Get Scripting in Java: Integrating with Groovy and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.