Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Java-Scala interoperability - April 2016
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
sullis
April 19, 2016
Programming
390
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Java-Scala interoperability - April 2016
Java-Scala interoperability
Portland Java User Group
April 19, 2016
sullis
April 19, 2016
More Decks by sullis
See All by sullis
Dependency Management for Java - Code Remix Summit 2026-05-12
sullis
0
86
AI Assisted Software Development - Portland Java User Group - 2026-04-14
sullis
0
94
Dependency Management for Java - Seattle 2025-11-18
sullis
0
64
Dependency Management for Java - Portland - 2025-11-04
sullis
0
45
Dependency management for Java applications 2025-09-11
sullis
0
63
S3 NYC Iceberg meetup 2025-07-10
sullis
0
66
Amazon S3 Chicago 2025-06-04
sullis
0
160
Amazon S3 Boston 2025-05-07
sullis
0
120
Netty ConFoo Montreal 2025-02-27
sullis
0
190
Other Decks in Programming
See All in Programming
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
4
3.2k
Press start. Python's next generation.
willingc
PRO
3
320
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
560
Oxlintはいいぞ(続)
yug1224
1
560
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
2
1.1k
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
260
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
140
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
440
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
270
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
210
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
340
58k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Designing for Performance
lara
611
70k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Unsuck your backbone
ammeep
672
58k
The Cult of Friendly URLs
andyhume
79
7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
490
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Transcript
Java-Scala interoperability Sean Sullivan April 19, 2016 Portland Java User
Group
• software engineer • 20 years Java • 5 years
at Gilt • back office systems @ Gilt About me
• Scala @ Gilt.com • Scala on the Java VM
• code examples Agenda
www.gilt.com
https://www.gilt.com/checkout
None
“The Scala 2.11.x series targets Java 6" http://www.scala-lang.org/news/2.11.0/
http://scala-lang.org/news/2.12-roadmap/ “The official Scala 2.12 distribution will be built for
Java 8 (and thus require it)”
Scala case classes and JSP’s
case class Thing( name: String, color: String)
thing.jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <body> <c:out value=“${myThing.name}”/>
</body> </html>
JSP expression language expects a JavaBean with “getter” methods
import scala.reflect.BeanProperty case class Thing( @BeanProperty name: String, @BeanProperty color:
String) @BeanProperty annotation
Collections
None
• convert java.util.List to Scala collection • convert java.util.Set to
Scala collection • convert java.util.Map to Scala collection • convert Scala List to java.util.List Common scenarios
import scala.collection.JavaConverters._
import java.util.{ArrayList => JArrayList} import scala.collection.JavaConverters._ val jArrayList =
new JArrayList[String] jArrayList.add("a") jArrayList.add("b") jArrayList.add("c") val scalaList = jArrayList.asScala scalaList should be (List("a", "b", "c"))
Google Guava library
• com.google.common.base.Optional • com.google.common.util.concurrent.ListenableFuture
Guava @ Gilt
Guava Optional -> Scala Option Scala Option -> Guava Optional
import com.gilt.gfc.guava.GuavaConverters._
Guava Future -> Scala Future Scala Future -> Guava Future
import com.gilt.gfc.guava.future.FutureConverters._
Java 8
https://github.com/scala/scala-java8-compat
import scala.compat.java8.FutureConverters._ Java 8 Future to Scala Future
import scala.compat.java8.OptionConverters._ java.util.Optional to scala.Option
https://github.com/sullis/java-scala-interop-examples
The end
None