forked from scala/scala-java8-compat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpliteratorConverters.scala
41 lines (34 loc) · 1.39 KB
/
SpliteratorConverters.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc. dba Akka
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.compat.java8
import language.implicitConversions
import java.util._
import scala.compat.java8.collectionImpl._
package SpliteratorConverters {
class SpliteratorToStepper[A] private[java8] (private val underlying: Spliterator[A]) extends AnyVal {
def stepper: AnyStepper[A] = Stepper.ofSpliterator(underlying)
}
trait Priority2SpliteratorConverters {
implicit def spliteratorToStepper[A](sp: Spliterator[A]) = new SpliteratorToStepper[A](sp)
}
}
package object SpliteratorConverters extends SpliteratorConverters.Priority2SpliteratorConverters {
implicit final class SpliteratorOfDoubleToStepper(private val underlying: Spliterator.OfDouble) extends AnyVal {
def stepper: DoubleStepper = Stepper.ofSpliterator(underlying)
}
implicit final class SpliteratorOfIntToStepper(private val underlying: Spliterator.OfInt) extends AnyVal {
def stepper: IntStepper = Stepper.ofSpliterator(underlying)
}
implicit final class SpliteratorOfLongToStepper(private val underlying: Spliterator.OfLong) extends AnyVal {
def stepper: LongStepper = Stepper.ofSpliterator(underlying)
}
}