Entry
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))
- Value parameters:
- key
the key of this entry
- value
the value of this entry
Value members
Concrete methods
Compares the specified object with this entry for equality.
Compares the specified object with this entry for equality.
- Value parameters:
- 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
- Equals -> Entry -> Any
Returns the key corresponding to this Entry
.
Returns the key corresponding to this Entry
.
- Returns:
the key corresponding to this entry
Returns the value corresponding to this entry.
Returns the value corresponding to this entry.
- Returns:
the value corresponding to this entry
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 -> Any
Throws UnsupportedOperationException
.
Throws UnsupportedOperationException
.
- Throws:
- UnsupportedOperationException
unconditionally
Returns a String
representation of this Entry
consisting of
concatenating the result of invoking toString
on the key
,
an equals sign, and the result of invoking toString
on the value
.
Returns a String
representation of this Entry
consisting of
concatenating the result of invoking toString
on the key
,
an equals sign, and the result of invoking toString
on the value
.
- Returns:
a
String
already!- Definition Classes
- Any