Skip to content

Commit

Permalink
use JavaConverters instead of JavaConversions
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jun 30, 2016
1 parent c402b62 commit ab9e806
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions concurrent/src/main/scala/scalaz/concurrent/Future.scala
Expand Up @@ -3,7 +3,7 @@ package scalaz.concurrent
import java.util.concurrent.{Callable, ConcurrentLinkedQueue, ExecutorService, TimeoutException, ScheduledExecutorService, TimeUnit}
import java.util.concurrent.atomic.{AtomicInteger, AtomicBoolean, AtomicReference}

import collection.JavaConversions._
import scala.collection.JavaConverters._
import scalaz.Tags.Parallel

import scalaz._
Expand Down Expand Up @@ -372,7 +372,7 @@ object Future {

// only last completed f will hit the 0 here.
if (c.decrementAndGet() == 0)
cb(results.toList.foldLeft(R.zero)((a, b) => R.append(a, b)))
cb(results.asScala.foldLeft(R.zero)((a, b) => R.append(a, b)))
else Trampoline.done(())
}
}
Expand Down
4 changes: 2 additions & 2 deletions concurrent/src/main/scala/scalaz/concurrent/Task.scala
Expand Up @@ -10,7 +10,7 @@ import scalaz.std.list._
import scalaz.Free.Trampoline
import scalaz.\/._

import collection.JavaConversions._
import scala.collection.JavaConverters._
import scala.concurrent.duration._

/**
Expand Down Expand Up @@ -413,7 +413,7 @@ object Task {

// only last completed f will hit the 0 here.
if (togo.decrementAndGet() == 0)
cb(\/-(results.toList.foldLeft(R.zero)((a, b) => R.append(a, b))))
cb(\/-(results.asScala.foldLeft(R.zero)((a, b) => R.append(a, b))))
else
Trampoline.done(())
case e@(-\/(failure)) =>
Expand Down
3 changes: 2 additions & 1 deletion tests/jvm/src/test/scala/scalaz/concurrent/TaskTest.scala
Expand Up @@ -222,13 +222,14 @@ object TaskTest extends SpecLite {
import Thread._
import java.{util => ju}
import ju.concurrent.CyclicBarrier
import scala.collection.JavaConverters._

//Ensure at least 6 different threads are available.
implicit val es6 =
Executors.newFixedThreadPool(6)
val barrier = new CyclicBarrier(6);

val seenThreadNames = scala.collection.JavaConversions.asScalaSet(ju.Collections.synchronizedSet(new ju.HashSet[String]()))
val seenThreadNames = ju.Collections.synchronizedSet(new ju.HashSet[String]()).asScala
val t =
for (i <- 0 to 5) yield fork {
seenThreadNames += currentThread().getName()
Expand Down

0 comments on commit ab9e806

Please sign in to comment.