This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
object MyPlugin extends Plugin { | |
val newSetting = settingKey[String]("A new setting.") | |
val newTask = taskKey[Unit]("A new task.") | |
override def projectSettings = Seq( | |
newSetting := "test", | |
newTask := println(newSetting.value) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import sbt.testing.Event | |
import scala.collection.{concurrent, mutable} | |
class ThreadSafeTestsListener extends TestReportListener { | |
val groups = concurrent.TrieMap.empty[String, TestGroup] | |
class TestGroup(val name: String) { | |
val events = new mutable.ArrayBuffer[Event] // does this need to be an ArrayBlockingQueue? | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Set[+A] extends (Any => Boolean) { self => | |
def contains(x: Any): Boolean | |
def apply(x: Any): Boolean = contains(x) | |
def + [B >: A](x: B): Set[B] = new Set[B] { | |
def contains(y: Any) = (y == x) || self.contains(y) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.generic.CanBuildFrom | |
import scala.collection.mutable.{Builder, ArrayBuffer, IndexedSeq, IndexedSeqLike} | |
import scala.specialized | |
trait Representation[Unboxed, Boxed] { | |
def box(x: Unboxed): Boxed | |
def unbox(x: Boxed): Unboxed | |
} | |
abstract class FlatArrayFactory[@specialized Unboxed: ClassManifest, Boxed] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.gist.jdolson.collection.mutable | |
import scala.collection.generic.CanBuildFrom | |
import scala.collection.mutable.{MapLike, MapBuilder, HashMap} | |
final class IdentityHashMap[A <: AnyRef, B]() extends HashMap[A, B] with MapLike[A, B, IdentityHashMap[A, B]] { | |
override protected def elemEquals(key1: A, key2: A): Boolean = key1 eq key2 | |
override protected def elemHashCode(key: A) = System.identityHashCode(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.gist.jdolson.collection.mutable | |
import scala.collection.mutable.{Set, Map, Iterable, Builder, Cloneable} | |
import scala.collection.generic.{CanBuildFrom, Shrinkable} | |
import scala.collection.{Iterator, IterableLike, breakOut} | |
object MultiMap { | |
type Coll = MultiMap[_, _] | |
implicit def canBuildFrom[A, B] = new CanBuildFrom[Coll, (A, B), MultiMap[A, B]] { |