case class Entry[K, V](key: K, value: V) extends java.util.Map.Entry[K, V] with Product with Serializable
A case class implementation of java.util.Map.Entry
to make it easier to
test Java Map
s with ScalaTest Matchers.
In Java, java.util.Map
is not a subtype of java.util.Collection
, and does not
actually define an element type. You can ask a Java Map
for an “entry set”
via the entrySet
method, which will return the Map
's key/value pairs
wrapped in a set of java.util.Map.Entry
, but a Map
is not actually
a collection of Entry
. To make Java Map
s easier to work with, however,
ScalaTest matchers allows you to treat a Java Map
as a collection of Entry
,
and defines this convenience implementation of java.util.Map.Entry
.
Here's how you use it:
javaMap should contain (Entry(2, 3)) javaMap should contain oneOf (Entry(2, 3), Entry(3, 4))
- key
the key of this entry
- value
the value of this entry
- Source
- Entry.scala
- Alphabetic
- By Inheritance
- Entry
- Serializable
- Product
- Equals
- Entry
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Entry(key: K, value: V)
- key
the key of this entry
- value
the value of this entry
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
Compares the specified object with this entry for equality.
Compares the specified object with this entry for equality.
- other
the object to be compared for equality with this map entry
- returns
true if the specified object is equal to this map entry
- Definition Classes
- Entry → Equals → Entry → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getKey(): K
Returns the key corresponding to this
Entry
.Returns the key corresponding to this
Entry
.- returns
the key corresponding to this entry
- Definition Classes
- Entry → Entry
- def getValue(): V
Returns the value corresponding to this entry.
Returns the value corresponding to this entry.
- returns
the value corresponding to this entry
- Definition Classes
- Entry → Entry
- def hashCode(): Int
Returns the hash code value for this map entry.
Returns the hash code value for this map entry.
- returns
the hash code value for this map entry
- Definition Classes
- Entry → Entry → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val key: K
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def setValue(v: V): V
Throws
UnsupportedOperationException
.Throws
UnsupportedOperationException
.- Definition Classes
- Entry → Entry
- Exceptions thrown
UnsupportedOperationException
unconditionally
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
Returns a
String
representation of thisEntry
consisting of concatenating the result of invokingtoString
on thekey
, an equals sign, and the result of invokingtoString
on thevalue
.Returns a
String
representation of thisEntry
consisting of concatenating the result of invokingtoString
on thekey
, an equals sign, and the result of invokingtoString
on thevalue
.- returns
a
String
already!
- Definition Classes
- Entry → AnyRef → Any
- val value: V
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()