How to make this Scala method return the same generic as the input?Create Generic method constraining T to an EnumHow do I use reflection to call a generic method?How can I return NULL from a generic method in C#?How do I make the method return type generic?How to create a generic array in Java?How to get the type of T from a member of a generic class or method?Scala: Abstract types vs genericsHow to get a class instance of generics type TUnderstanding Scala's flatmap type conversionshow to make Scala canBuildFrom to build collection type from Seq to Set
What is the source of 'Ma'alin bekodesh'?
Changing the PK column of a data extension without completely recreating it
Is it possible to have battery technology that can't be duplicated?
Do Veracrypt encrypted volumes have any kind of brute force protection?
Is there a radar system monitoring the UK mainland border?
A life of PhD: is it feasible?
Identification: what type of connector does the pictured socket take?
Is it good practice to create tables dynamically?
What is the theme of analysis?
Was the Lonely Mountain, where Smaug lived, a volcano?
How to represent jealousy in a cute way?
Is it a good security practice to force employees hide their employer to avoid being targeted?
Table with varying step
Why is my Taiyaki (Cake that looks like a fish) too hard and dry?
Why does there seem to be an extreme lack of public trashcans in Taiwan?
Can I attach a DC blower to intake manifold of my 150CC Yamaha FZS FI engine?
Why is it bad to use your whole foot in rock climbing
How can religions without a hell discourage evil-doing?
Keeping track of theme when improvising
Does WiFi affect the quality of images downloaded from the internet?
What do you call the action of "describing events as they happen" like sports anchors do?
Is it true that "only photographers care about noise"?
What's the relation between у.е. to USD?
Can you open the door or die? v2
How to make this Scala method return the same generic as the input?
Create Generic method constraining T to an EnumHow do I use reflection to call a generic method?How can I return NULL from a generic method in C#?How do I make the method return type generic?How to create a generic array in Java?How to get the type of T from a member of a generic class or method?Scala: Abstract types vs genericsHow to get a class instance of generics type TUnderstanding Scala's flatmap type conversionshow to make Scala canBuildFrom to build collection type from Seq to Set
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I want to split a string delimited by commas and use the result as either a Seq
or a Set
:
def splitByComma(commaDelimited: String): Array[String]
= commaDelimited.trim.split(',')
def splitByCommaAsSet(commaDelimited: String): Set[String]
= splitByComma(commaDelimited).toSet
def splitByCommaAsSeq(commaDelimited: String): Seq[String]
= splitByComma(commaDelimited).toSeq
val foods = "sushi,taco,burrito"
val foodSet = splitByCommaAsSet(foods)
// foodSet: scala.collection.immutable.Set[String] = Set(sushi, taco, burrito)
val foodSeq = splitByCommaAsSeq(foods)
// foodSeq: Seq[String] = List(sushi, taco, burrito)
However, this is quite repetitive. Ideally, I would want to have something like genericSplitByComma[Set](foods)
that just returns a Set
when I pass Set
in, and returns a Seq
when I pass Seq
.
scala generics type-conversion polymorphism scala-collections
add a comment |
I want to split a string delimited by commas and use the result as either a Seq
or a Set
:
def splitByComma(commaDelimited: String): Array[String]
= commaDelimited.trim.split(',')
def splitByCommaAsSet(commaDelimited: String): Set[String]
= splitByComma(commaDelimited).toSet
def splitByCommaAsSeq(commaDelimited: String): Seq[String]
= splitByComma(commaDelimited).toSeq
val foods = "sushi,taco,burrito"
val foodSet = splitByCommaAsSet(foods)
// foodSet: scala.collection.immutable.Set[String] = Set(sushi, taco, burrito)
val foodSeq = splitByCommaAsSeq(foods)
// foodSeq: Seq[String] = List(sushi, taco, burrito)
However, this is quite repetitive. Ideally, I would want to have something like genericSplitByComma[Set](foods)
that just returns a Set
when I pass Set
in, and returns a Seq
when I pass Seq
.
scala generics type-conversion polymorphism scala-collections
add a comment |
I want to split a string delimited by commas and use the result as either a Seq
or a Set
:
def splitByComma(commaDelimited: String): Array[String]
= commaDelimited.trim.split(',')
def splitByCommaAsSet(commaDelimited: String): Set[String]
= splitByComma(commaDelimited).toSet
def splitByCommaAsSeq(commaDelimited: String): Seq[String]
= splitByComma(commaDelimited).toSeq
val foods = "sushi,taco,burrito"
val foodSet = splitByCommaAsSet(foods)
// foodSet: scala.collection.immutable.Set[String] = Set(sushi, taco, burrito)
val foodSeq = splitByCommaAsSeq(foods)
// foodSeq: Seq[String] = List(sushi, taco, burrito)
However, this is quite repetitive. Ideally, I would want to have something like genericSplitByComma[Set](foods)
that just returns a Set
when I pass Set
in, and returns a Seq
when I pass Seq
.
scala generics type-conversion polymorphism scala-collections
I want to split a string delimited by commas and use the result as either a Seq
or a Set
:
def splitByComma(commaDelimited: String): Array[String]
= commaDelimited.trim.split(',')
def splitByCommaAsSet(commaDelimited: String): Set[String]
= splitByComma(commaDelimited).toSet
def splitByCommaAsSeq(commaDelimited: String): Seq[String]
= splitByComma(commaDelimited).toSeq
val foods = "sushi,taco,burrito"
val foodSet = splitByCommaAsSet(foods)
// foodSet: scala.collection.immutable.Set[String] = Set(sushi, taco, burrito)
val foodSeq = splitByCommaAsSeq(foods)
// foodSeq: Seq[String] = List(sushi, taco, burrito)
However, this is quite repetitive. Ideally, I would want to have something like genericSplitByComma[Set](foods)
that just returns a Set
when I pass Set
in, and returns a Seq
when I pass Seq
.
scala generics type-conversion polymorphism scala-collections
scala generics type-conversion polymorphism scala-collections
edited 8 hours ago
jwvh
30.7k52242
30.7k52242
asked 8 hours ago
yhylordyhylord
1167
1167
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
@KrzysztofAtłasik's answer works great for Scala 2.12
.
This is a solution for 2.13
. (Not completely sure if this is the best way).
import scala.collection.Factory
import scala.language.higherKinds
def splitByComma[C[_]](commaDelimited: String)(implicit f: Factory[String, C[String]]): C[String] =
f.fromSpecific(commaDelimited.split(","))
// Or, as Dmytro stated, which I have to agree looks better.
commaDelimited.split(",").to(f)
Which you can use like this:
splitByComma[Array]("hello,world!")
// res: Array[String] = Array(hello, world!)
splitByComma[Set]("hello,world!")
// res: Set[String] = Set(hello, world!)
splitByComma[List]("hello,world!")
// res: List[String] = List(hello, world!)
2
OrcommaDelimited.split(",").to(f)
.
– Dmytro Mitin
7 hours ago
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
@DmytroMitin Oh, so that was the change ofto[List]
toto(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D
– Luis Miguel Mejía Suárez
7 hours ago
add a comment |
There's method in Scala called to
which can transform arbitrary collection to another as long as there is typeclass called CanBuildFrom
in scope.
import scala.collection.generic.CanBuildFrom
import scala.languageFeature.higherKinds
def genericSplitByComma[S[_]](s: String)(implicit cbf: CanBuildFrom[Nothing, String, S[String]]): S[String] =
s.split(",").to[S]
genericSplitByComma[Set]("Hello, hello") //Set(Hello, hello)
genericSplitByComma[List]("Hello, hello") //List(Hello, hello)
genericSplitByComma[Array]("Hello, hello") //Array(hello, world!)
We don't need to constrain S[_]
because this function won't compile if there is no suitable CanBuildFrom
in scope. For example, this will fail:
genericSplitByComma[Option]("Hello, hello")
Below will also fail because our type constructor S[_]
accepts only one type argument and the map expects two:
genericSplitByComma[Map]("Hello, hello")
As Luis Miguel Mejía Suárez and Dmytro Mitin noticed, there was major refactor in collections in just-released Scala 2.13, so it will work up to Scala 2.12.
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
add a comment |
There's a simple workaround for this. Not exactly the requested syntax but just as concise and it should be 2.13 compatible.
def simpleSplitByComma(coll :Iterable[String]) =
coll.flatMap(_.trim.split(","))
simpleSplitByComma(Set("hello,world")) //res0: Set(hello, world)
simpleSplitByComma(Seq("bellow,world")) //res1: List(bellow, world)
simpleSplitByComma(Array("fellow,old")) //res2: ArrayBuffer(fellow, old)
simpleSplitByComma(Stream("end,of,the,world")) //res3: Stream(end, ?)
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56551015%2fhow-to-make-this-scala-method-return-the-same-generic-as-the-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
@KrzysztofAtłasik's answer works great for Scala 2.12
.
This is a solution for 2.13
. (Not completely sure if this is the best way).
import scala.collection.Factory
import scala.language.higherKinds
def splitByComma[C[_]](commaDelimited: String)(implicit f: Factory[String, C[String]]): C[String] =
f.fromSpecific(commaDelimited.split(","))
// Or, as Dmytro stated, which I have to agree looks better.
commaDelimited.split(",").to(f)
Which you can use like this:
splitByComma[Array]("hello,world!")
// res: Array[String] = Array(hello, world!)
splitByComma[Set]("hello,world!")
// res: Set[String] = Set(hello, world!)
splitByComma[List]("hello,world!")
// res: List[String] = List(hello, world!)
2
OrcommaDelimited.split(",").to(f)
.
– Dmytro Mitin
7 hours ago
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
@DmytroMitin Oh, so that was the change ofto[List]
toto(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D
– Luis Miguel Mejía Suárez
7 hours ago
add a comment |
@KrzysztofAtłasik's answer works great for Scala 2.12
.
This is a solution for 2.13
. (Not completely sure if this is the best way).
import scala.collection.Factory
import scala.language.higherKinds
def splitByComma[C[_]](commaDelimited: String)(implicit f: Factory[String, C[String]]): C[String] =
f.fromSpecific(commaDelimited.split(","))
// Or, as Dmytro stated, which I have to agree looks better.
commaDelimited.split(",").to(f)
Which you can use like this:
splitByComma[Array]("hello,world!")
// res: Array[String] = Array(hello, world!)
splitByComma[Set]("hello,world!")
// res: Set[String] = Set(hello, world!)
splitByComma[List]("hello,world!")
// res: List[String] = List(hello, world!)
2
OrcommaDelimited.split(",").to(f)
.
– Dmytro Mitin
7 hours ago
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
@DmytroMitin Oh, so that was the change ofto[List]
toto(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D
– Luis Miguel Mejía Suárez
7 hours ago
add a comment |
@KrzysztofAtłasik's answer works great for Scala 2.12
.
This is a solution for 2.13
. (Not completely sure if this is the best way).
import scala.collection.Factory
import scala.language.higherKinds
def splitByComma[C[_]](commaDelimited: String)(implicit f: Factory[String, C[String]]): C[String] =
f.fromSpecific(commaDelimited.split(","))
// Or, as Dmytro stated, which I have to agree looks better.
commaDelimited.split(",").to(f)
Which you can use like this:
splitByComma[Array]("hello,world!")
// res: Array[String] = Array(hello, world!)
splitByComma[Set]("hello,world!")
// res: Set[String] = Set(hello, world!)
splitByComma[List]("hello,world!")
// res: List[String] = List(hello, world!)
@KrzysztofAtłasik's answer works great for Scala 2.12
.
This is a solution for 2.13
. (Not completely sure if this is the best way).
import scala.collection.Factory
import scala.language.higherKinds
def splitByComma[C[_]](commaDelimited: String)(implicit f: Factory[String, C[String]]): C[String] =
f.fromSpecific(commaDelimited.split(","))
// Or, as Dmytro stated, which I have to agree looks better.
commaDelimited.split(",").to(f)
Which you can use like this:
splitByComma[Array]("hello,world!")
// res: Array[String] = Array(hello, world!)
splitByComma[Set]("hello,world!")
// res: Set[String] = Set(hello, world!)
splitByComma[List]("hello,world!")
// res: List[String] = List(hello, world!)
edited 7 hours ago
answered 8 hours ago
Luis Miguel Mejía SuárezLuis Miguel Mejía Suárez
3,83121123
3,83121123
2
OrcommaDelimited.split(",").to(f)
.
– Dmytro Mitin
7 hours ago
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
@DmytroMitin Oh, so that was the change ofto[List]
toto(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D
– Luis Miguel Mejía Suárez
7 hours ago
add a comment |
2
OrcommaDelimited.split(",").to(f)
.
– Dmytro Mitin
7 hours ago
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
@DmytroMitin Oh, so that was the change ofto[List]
toto(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D
– Luis Miguel Mejía Suárez
7 hours ago
2
2
Or
commaDelimited.split(",").to(f)
.– Dmytro Mitin
7 hours ago
Or
commaDelimited.split(",").to(f)
.– Dmytro Mitin
7 hours ago
1
1
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
Happy 2.13! I also wondered. def splitByComma[C](s: String)(implicit f: Factory[String, C]): C = s.split(",").to(f)
– som-snytt
7 hours ago
2
2
@DmytroMitin Oh, so that was the change of
to[List]
to to(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D– Luis Miguel Mejía Suárez
7 hours ago
@DmytroMitin Oh, so that was the change of
to[List]
to to(List)
, because it now receives a factory an every companion object is now a factory, I finally get it :D– Luis Miguel Mejía Suárez
7 hours ago
add a comment |
There's method in Scala called to
which can transform arbitrary collection to another as long as there is typeclass called CanBuildFrom
in scope.
import scala.collection.generic.CanBuildFrom
import scala.languageFeature.higherKinds
def genericSplitByComma[S[_]](s: String)(implicit cbf: CanBuildFrom[Nothing, String, S[String]]): S[String] =
s.split(",").to[S]
genericSplitByComma[Set]("Hello, hello") //Set(Hello, hello)
genericSplitByComma[List]("Hello, hello") //List(Hello, hello)
genericSplitByComma[Array]("Hello, hello") //Array(hello, world!)
We don't need to constrain S[_]
because this function won't compile if there is no suitable CanBuildFrom
in scope. For example, this will fail:
genericSplitByComma[Option]("Hello, hello")
Below will also fail because our type constructor S[_]
accepts only one type argument and the map expects two:
genericSplitByComma[Map]("Hello, hello")
As Luis Miguel Mejía Suárez and Dmytro Mitin noticed, there was major refactor in collections in just-released Scala 2.13, so it will work up to Scala 2.12.
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
add a comment |
There's method in Scala called to
which can transform arbitrary collection to another as long as there is typeclass called CanBuildFrom
in scope.
import scala.collection.generic.CanBuildFrom
import scala.languageFeature.higherKinds
def genericSplitByComma[S[_]](s: String)(implicit cbf: CanBuildFrom[Nothing, String, S[String]]): S[String] =
s.split(",").to[S]
genericSplitByComma[Set]("Hello, hello") //Set(Hello, hello)
genericSplitByComma[List]("Hello, hello") //List(Hello, hello)
genericSplitByComma[Array]("Hello, hello") //Array(hello, world!)
We don't need to constrain S[_]
because this function won't compile if there is no suitable CanBuildFrom
in scope. For example, this will fail:
genericSplitByComma[Option]("Hello, hello")
Below will also fail because our type constructor S[_]
accepts only one type argument and the map expects two:
genericSplitByComma[Map]("Hello, hello")
As Luis Miguel Mejía Suárez and Dmytro Mitin noticed, there was major refactor in collections in just-released Scala 2.13, so it will work up to Scala 2.12.
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
add a comment |
There's method in Scala called to
which can transform arbitrary collection to another as long as there is typeclass called CanBuildFrom
in scope.
import scala.collection.generic.CanBuildFrom
import scala.languageFeature.higherKinds
def genericSplitByComma[S[_]](s: String)(implicit cbf: CanBuildFrom[Nothing, String, S[String]]): S[String] =
s.split(",").to[S]
genericSplitByComma[Set]("Hello, hello") //Set(Hello, hello)
genericSplitByComma[List]("Hello, hello") //List(Hello, hello)
genericSplitByComma[Array]("Hello, hello") //Array(hello, world!)
We don't need to constrain S[_]
because this function won't compile if there is no suitable CanBuildFrom
in scope. For example, this will fail:
genericSplitByComma[Option]("Hello, hello")
Below will also fail because our type constructor S[_]
accepts only one type argument and the map expects two:
genericSplitByComma[Map]("Hello, hello")
As Luis Miguel Mejía Suárez and Dmytro Mitin noticed, there was major refactor in collections in just-released Scala 2.13, so it will work up to Scala 2.12.
There's method in Scala called to
which can transform arbitrary collection to another as long as there is typeclass called CanBuildFrom
in scope.
import scala.collection.generic.CanBuildFrom
import scala.languageFeature.higherKinds
def genericSplitByComma[S[_]](s: String)(implicit cbf: CanBuildFrom[Nothing, String, S[String]]): S[String] =
s.split(",").to[S]
genericSplitByComma[Set]("Hello, hello") //Set(Hello, hello)
genericSplitByComma[List]("Hello, hello") //List(Hello, hello)
genericSplitByComma[Array]("Hello, hello") //Array(hello, world!)
We don't need to constrain S[_]
because this function won't compile if there is no suitable CanBuildFrom
in scope. For example, this will fail:
genericSplitByComma[Option]("Hello, hello")
Below will also fail because our type constructor S[_]
accepts only one type argument and the map expects two:
genericSplitByComma[Map]("Hello, hello")
As Luis Miguel Mejía Suárez and Dmytro Mitin noticed, there was major refactor in collections in just-released Scala 2.13, so it will work up to Scala 2.12.
edited 7 hours ago
answered 8 hours ago
Krzysztof AtłasikKrzysztof Atłasik
8,82221442
8,82221442
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
add a comment |
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
3
3
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
In 2.13 this changed.
– Dmytro Mitin
8 hours ago
add a comment |
There's a simple workaround for this. Not exactly the requested syntax but just as concise and it should be 2.13 compatible.
def simpleSplitByComma(coll :Iterable[String]) =
coll.flatMap(_.trim.split(","))
simpleSplitByComma(Set("hello,world")) //res0: Set(hello, world)
simpleSplitByComma(Seq("bellow,world")) //res1: List(bellow, world)
simpleSplitByComma(Array("fellow,old")) //res2: ArrayBuffer(fellow, old)
simpleSplitByComma(Stream("end,of,the,world")) //res3: Stream(end, ?)
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
add a comment |
There's a simple workaround for this. Not exactly the requested syntax but just as concise and it should be 2.13 compatible.
def simpleSplitByComma(coll :Iterable[String]) =
coll.flatMap(_.trim.split(","))
simpleSplitByComma(Set("hello,world")) //res0: Set(hello, world)
simpleSplitByComma(Seq("bellow,world")) //res1: List(bellow, world)
simpleSplitByComma(Array("fellow,old")) //res2: ArrayBuffer(fellow, old)
simpleSplitByComma(Stream("end,of,the,world")) //res3: Stream(end, ?)
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
add a comment |
There's a simple workaround for this. Not exactly the requested syntax but just as concise and it should be 2.13 compatible.
def simpleSplitByComma(coll :Iterable[String]) =
coll.flatMap(_.trim.split(","))
simpleSplitByComma(Set("hello,world")) //res0: Set(hello, world)
simpleSplitByComma(Seq("bellow,world")) //res1: List(bellow, world)
simpleSplitByComma(Array("fellow,old")) //res2: ArrayBuffer(fellow, old)
simpleSplitByComma(Stream("end,of,the,world")) //res3: Stream(end, ?)
There's a simple workaround for this. Not exactly the requested syntax but just as concise and it should be 2.13 compatible.
def simpleSplitByComma(coll :Iterable[String]) =
coll.flatMap(_.trim.split(","))
simpleSplitByComma(Set("hello,world")) //res0: Set(hello, world)
simpleSplitByComma(Seq("bellow,world")) //res1: List(bellow, world)
simpleSplitByComma(Array("fellow,old")) //res2: ArrayBuffer(fellow, old)
simpleSplitByComma(Stream("end,of,the,world")) //res3: Stream(end, ?)
answered 7 hours ago
jwvhjwvh
30.7k52242
30.7k52242
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
add a comment |
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
Now we must wait and see where yhylord places the green check!
– som-snytt
7 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
I really like this one and will probably use something like this, but I feel like I have to accept another answer that exactly matches what I asked :)
– yhylord
4 hours ago
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56551015%2fhow-to-make-this-scala-method-return-the-same-generic-as-the-input%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown