This page is no longer maintained — Please continue to the home page at www.scala-lang.org

A collection of LinearSeqLike

1 reply
edmondo1984
Joined: 2011-09-14,
User offline. Last seen 28 weeks 3 days ago.
Dear All,I would like to implement something like thatclass MultipleCollection[A](items:IndexedSeq[LinearSeqLike[A,_]){
def filter = new example(items.map(_.filter)); }
this does not work because the _ is resolved to Any, and therefore filter returns any.
How does one solve this?
Best Regards
Edmondo
dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: A collection of LinearSeqLike

What is the problem of adding a B to the type parameters and writing
LienarSeqLike[A, B]?

On Tue, Jan 24, 2012 at 13:36, Edmondo Porcu wrote:
> Dear All,
> I would like to implement something like that
> class MultipleCollection[A](items:IndexedSeq[LinearSeqLike[A,_]){
>
> def filter = new example(items.map(_.filter));
> }
>
> this does not work because the _ is resolved to Any, and therefore filter
> returns any.
>
> How does one solve this?
>
> Best Regards
>
> Edmondo

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland