score:3
Accepted answer
you already gave the answer yourself: if you want to be able to return a bitset
in appropriate cases, you need to get rid of that type parameter in the return type. there is no bitset[int]
, obviously.
all the information you need is already handled by the appropriate canbuildfrom
implicits which have a fallback definition of the type canbuildfrom[coll, a, traversable[a]]
(or whatever may be over traversable
in the type hierarchy).
of course, the canbuildfrom
must be sensible but i think it’s actually possible to abuse it and return a truly strange that
. nonetheless, the defaults are pretty sane.
Source: stackoverflow.com
Related Query
- just another canBuildFrom question
- Another Scala CanBuildFrom issue: a collection enrichment operator that wraps another of a different type
- Yet another command-line argument with spaces question
- Java GAE maven configuration problem? just another VerifyError
- How to clone a case class instance and change just one field in Scala?
- Akka in Scala, exclamation mark and question mark
- Do I need to re-use the same Akka ActorSystem or can I just create one every time I need one?
- Is Scala idiomatic coding style just a cool trap for writing inefficient code?
- How to reference external sbt project from another sbt project?
- How do I easily convert from one collection type to another during a filter, map, flatMap in Scala?
- Convert Scala List to List with another type
- Why to use empty parentheses in Scala if we can just use no parentheses to define a function which does not need any arguments?
- How to add a Spark Dataframe to the bottom of another dataframe?
- Scala 2.8 CanBuildFrom
- Simple question about tuple of scala
- Why people define class, trait, object inside another object in Scala?
- Why (copy) appending to Seq in Scala is defined as :+ and not just + as in Set and Map?
- Shapeless - turn a case class into another with fields in different order
- Why `this.synchronized` instead of just `synchronized` in Scala?
- Using partitionBy on a DataFrameWriter writes directory layout with column names not just values
- What does the triple question mark mean in scala?
- Working with scala collections - CanBuildFrom trouble
- Basic Scala OOP question - pass by reference?
- How can I call another task from my SBT task?
- Is it just a coincidence that Kleisli, ReaderT, and Reader are the same in Scalaz
- Is it possible for an optional argument value to depend on another argument in Scala
- Scala String Equality Question from Programming Interview
- Efficacy of sticking to just the functional paradigm in Scala
- How can a parameter's default value reference another parameter?
- Scala: Yielding from one type of collection to another
More Query from same tag
- How to consume HttpResponse in Akka Http
- How do I translate this type lambda into Kind-Projector syntax?
- Scala generics: Int not conforming to Comparable?
- Rendering an "Inter-"CategoryMarker in JFreeChart
- How list all unresolved dependencies in sbt?
- Why won't resultSet.next() advance when there's clearly more data?
- How can I scan portions of a huge Scala Array[Byte] for individual Chars?
- How to access non-public fields and inheritent fields in scala
- Akka cluster sharding configuration
- Implicit parameters with 2 instances of the same type
- Fastest way to parse fixed length fields out of a byte array in scala?
- IllegalAccessError for dynamic class loader
- spark dataframe aggregation of column based on condition in scala
- Transform one case class into another when the argument list is the same
- Scala named arguments with default (generics type) arguments
- Type mismatch: scala.xml.NodeBuffer vs Seq[scala.xml.Node]
- What is the meaning of this snippet of code?
- How to filter rows having array of struct?
- Scala and diamond inheritance when using traits
- Open CV java.lang.UnsatisfiedLinkError
- How can count words of multiple files present in a directory using spark scala
- Use type class to calculate the sum of each string's length
- Swap constructor arguments
- Can type constructors be considered as types in functional programming languages?
- How do I make IntelliJ IDEA run all the tests including sub packages
- Scala: How to uppercase every other letter
- How to map/convert each element in the ArrayType in Apache Spark 2.3.1
- Scala compilation error on nested pattern matching
- Scala: SeqT monad transformer?
- Scala akka typed: how to get ActorRef to Actor from it's instance and send message itself?