Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scala for Java Developers

You're reading from   Scala for Java Developers Build reactive, scalable applications and integrate Java code with the power of Scala.

Arrow left icon
Product type Paperback
Published in Apr 2014
Publisher
ISBN-13 9781783283637
Length 282 pages
Edition Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Thomas Alexandre Thomas Alexandre
Author Profile Icon Thomas Alexandre
Thomas Alexandre
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Scala for Java Developers
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Programming Interactively within Your Project 2. Code Integration FREE CHAPTER 3. Understanding the Scala Ecosystem 4. Testing Tools 5. Getting Started with the Play Framework 6. Database Access and the Future of ORM 7. Working with Integration and Web Services 8. Essential Properties of Modern Applications – Asynchrony and Concurrency 9. Building Reactive Web Applications 10. Scala Goodies Index

Scala and Java collaboration


Going back to the REPL, we are going to experiment further with mixing Scala and Java to explore some common integration needs, and in particular, testing and manipulating the Java REST API that we have built at the beginning of the chapter.

As a reminder on how to restart the REPL from the hello-scala project introduced in Chapter 1, Programming Interactively within Your Project, if you closed it in the meantime, just start a new terminal window, navigate to the root of the hello-scala project, and enter the following command in the command prompt:

> ./activator console

Converting between collection types

Let's start by comparing Java and Scala collection classes and see how we can go from one to the other. For instance, a Scala List (from the scala.collection.immutable package) is different from java.util.List, and sometimes, it can be useful to convert from one to the other. A convenient way in Java to create java.util.List is to use the java.util.Arrays...

You have been reading a chapter from
Scala for Java Developers
Published in: Apr 2014
Publisher:
ISBN-13: 9781783283637
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime