Package components.map
Class Map1L<K,V>
java.lang.Object
components.map.MapSecondary<K,V>
components.map.Map1L<K,V>
- Type Parameters:
K
- type ofMap
domain (key) entriesV
- type ofMap
range (associated value) entries
Map
represented as a java.util.Map
with
implementations of primary methods.- Abstraction Relation (interpretation mapping between $this and this):
this = [value of $this]
-
Nested Class Summary
Nested classes/interfaces inherited from class components.map.MapSecondary
MapSecondary.SimplePair<K,
V> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds the pair (key
,value
) to this.final void
clear()
Resetsthis
to an initial value.final boolean
Reports whether there is a pair inthis
whose first component iskey
.iterator()
Returns a new object with the same dynamic type asthis
, having an initial value.Removes the pair whose first component iskey
and returns it.Removes and returns an arbitrary pair fromthis
.final V
replaceValue
(K key, V value) Replaces the value associated withkey
inthis
withvalue
and returns the old value.final int
size()
Reports size ofthis
.final void
transferFrom
(Map<K, V> source) Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must be the same as the dynamic type ofthis
.final V
Reports the value associated withkey
inthis
.Methods inherited from class components.map.MapSecondary
combineWith, equals, hashCode, hasValue, key, sharesKeyWith, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Map1L
public Map1L()No-argument constructor.
-
-
Method Details
-
newInstance
Description copied from interface:Standard
Returns a new object with the same dynamic type asthis
, having an initial value. If the typeT
has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor forT
. IfT
does not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initializethis
.- Returns:
- new object "like"
this
with an initial value
-
clear
Description copied from interface:Standard
Resetsthis
to an initial value. If the typeT
has a no-argument constructor, thenthis
satisfies the contract of the no-argument constructor forT
. IfT
does not have a no-argument constructor, thenthis
satisfies the contract of the constructor call that was used to initialize#this
. -
transferFrom
Description copied from interface:Standard
Setsthis
to the incoming value ofsource
, and resetssource
to an initial value; the declaration notwithstanding, the dynamic type ofsource
must be the same as the dynamic type ofthis
. If the typeT
has a no-argument constructor, thensource
satisfies the contract of the no-argument constructor forT
. IfT
does not have a no-argument constructor, thensource
satisfies the contract of the constructor call that was used to initialize#source
.- Parameters:
source
- object whose value is to be transferred
-
add
Description copied from interface:MapKernel
Adds the pair (key
,value
) to this.- Parameters:
key
- the key to be addedvalue
- the associated value to be added
-
remove
Description copied from interface:MapKernel
Removes the pair whose first component iskey
and returns it.- Parameters:
key
- the key to be removed- Returns:
- the pair removed
-
removeAny
Description copied from interface:MapKernel
Removes and returns an arbitrary pair fromthis
.- Returns:
- the pair removed from
this
-
value
Description copied from interface:MapKernel
Reports the value associated withkey
inthis
.- Parameters:
key
- the key whose associated value is to be reported- Returns:
- the value associated with key
-
hasKey
Description copied from interface:MapKernel
Reports whether there is a pair inthis
whose first component iskey
.- Parameters:
key
- the key to be checked- Returns:
- true iff there is a pair in this whose first component is
key
-
size
Description copied from interface:MapKernel
Reports size ofthis
.- Returns:
- the number of pairs in
this
-
iterator
-
replaceValue
Description copied from interface:Map
Replaces the value associated withkey
inthis
withvalue
and returns the old value.- Specified by:
replaceValue
in interfaceMap<K,
V> - Overrides:
replaceValue
in classMapSecondary<K,
V> - Parameters:
key
- the key whose associated value is replacedvalue
- the value replacing the old one- Returns:
- the old value associated with the given key
-