Quantcast
Channel: generic type
Viewing all articles
Browse latest Browse all 4

How to write a Scala method that takes a simple generic type

$
0
0
How to write a Scala method that takes a simple generic type alvin June 21, 2015 - 1:20pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 19.2, “How to write a Scala method that takes a simple generic type.”

Problem

You’re not concerned about type variance, and want to create a Scala method (or function) that takes a generic type, such as a method that accepts a Seq[A] parameter.


Viewing all articles
Browse latest Browse all 4

Trending Articles