Skip to content

Commit

Permalink
Removed EmptyVector
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Aug 1, 2010
1 parent 73e0bd8 commit 045f971
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/com/codecommit/collection/Vector.scala
Expand Up @@ -115,7 +115,7 @@ class Vector[+T] private (val length: Int, trie: Case, tail: Array[AnyRef])
if (length == 0) {
throw new IllegalStateException("Can't pop empty vector")
} else if (length == 1) {
EmptyVector
Vector.empty
} else if (tail.length > 1) {
val tail2 = new Array[AnyRef](tail.length - 1)
Array.copy(tail, 0, tail2, 0, tail2.length)
Expand Down Expand Up @@ -154,8 +154,10 @@ object Vector extends SeqFactory[Vector] {

private[collection] val EmptyArray = new Array[AnyRef](0)

private[this] val emptyVector = new Vector[Nothing]

@inline
override def empty[A]: Vector[A] = EmptyVector
override def empty[A]: Vector[A] = emptyVector

@inline
private[collection] def array(elem: AnyRef) = {
Expand All @@ -165,8 +167,6 @@ object Vector extends SeqFactory[Vector] {
}
}

object EmptyVector extends Vector[Nothing]

private[collection] object VectorCases {
@inline
private[this] def copy1(array1: Array[AnyRef], array2: Array[AnyRef]) = {
Expand Down
4 changes: 2 additions & 2 deletions src/spec/scala/VectorSpecs.scala
@@ -1,7 +1,7 @@
import org.specs._
import org.scalacheck._

import com.codecommit.collection.{EmptyVector, Vector}
import com.codecommit.collection.Vector

object VectorSpecs extends Specification with ScalaCheck {
import Prop._
Expand Down Expand Up @@ -93,7 +93,7 @@ object VectorSpecs extends Specification with ScalaCheck {

"fail on pop empty vector" in {
val caughtExcept = try {
EmptyVector.pop
Vector.empty.pop
false
} catch {
case _: IllegalStateException => true
Expand Down

0 comments on commit 045f971

Please sign in to comment.