java.lang.Object
io.qt.QtObject
io.qt.core.QMap<Key,T>
- All Implemented Interfaces:
QtObjectInterface
,Cloneable
,Iterable<QPair<Key,
,T>> Map<Key,
,T> NavigableMap<Key,
,T> SortedMap<Key,
T>
Java wrapper for Qt class QMap
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionQMap
(QMetaType.Type keyMetaType, QMetaType valueMetaType) Creating a container with given key and value type.QMap
(QMetaType.Type keyMetaType, QMetaType.Type valueMetaType) Creating a container with given key and value type.QMap
(QMetaType.Type keyMetaType, Class<T> valueType) Creating a container with given key and value type.Creating a container with given key and value type.QMap
(QMetaType keyMetaType, QMetaType.Type valueMetaType) Creating a container with given key and value type.Creating a container with given key and value type.Creating a container with given key and value type.QMap
(Class<Key> keyType, QMetaType.Type valueMetaType) Creating a container with given key and value type.Creating a container with given key and value type.Creating a container with given content. -
Method Summary
Modifier and TypeMethodDescriptionprotected final QAssociativeIterator<Key,
T> begin()
Provides a mutable C++ iterator to the containers begin.ceilingEntry
(Key key) Returns a key-value mapping associated with the least key greater than or equal to the given key, ornull
if there is no such key.final Key
ceilingKey
(Key key) Returns the least key greater than or equal to the given key, ornull
if there is no such key.final void
clear()
SeeQMap::
clear() clone()
Creates and returns a copy of this object.final Comparator<Key>
Returns the maps comparator.protected final QAssociativeConstIterator<Key,
T> Provides a constant C++ iterator to the containers begin.protected final QAssociativeConstIterator<Key,
T> constEnd()
Provides a constant C++ iterator to the containers end.final boolean
final boolean
containsKey
(Object key) Returnstrue
if this map contains a mapping for the specified key.final boolean
containsValue
(Object value) Returnstrue
if this map maps one or more keys to the specified value.final int
count()
final int
Creating aQMap
withQVariant
type (QMap<QString,QVariant>
).final NavigableSet<Key>
Returns a reverse orderNavigableSet
view of the keys contained in this map.final NavigableMap<Key,
T> Returns a reverse order view of the mappings contained in this map.protected final QAssociativeIterator<Key,
T> end()
Provides a mutable C++ iterator to the containers end.entrySet()
Returns aSet
view of the mappings contained in this map.boolean
final QAssociativeConstIterator<Key,
T> final T
first()
Returns a key-value mapping associated with the least key in this map, ornull
if the map is empty.final Key
firstKey()
floorEntry
(Key key) Returns a key-value mapping associated with the greatest key less than or equal to the given key, ornull
if there is no such key.final Key
Returns the greatest key less than or equal to the given key, ornull
if there is no such key.final T
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key.int
hashCode()
Returns the objects's hash code computed byqHash(QMap<Key,T>)
.final NavigableMap<Key,
T> Equivalent toheadMap(toKey, false)
.final NavigableMap<Key,
T> Returns a view of the portion of this map whose keys are less than (or equal to, ifinclusive
is true)toKey
.higherEntry
(Key key) Returns a key-value mapping associated with the least key strictly greater than the given key, ornull
if there is no such key.final Key
Returns the least key strictly greater than the given key, ornull
if there is no such key.final void
final boolean
isEmpty()
iterator()
Returns an iterator over elements of typeQPair<K,V>
.final Key
final Key
keys()
Returns aList
of the keys contained in this associative container.keySet()
Returns aSet
view of the keys contained in this map.final T
last()
Returns a key-value mapping associated with the greatest key in this map, ornull
if the map is empty.final Key
lastKey()
final QAssociativeConstIterator<Key,
T> lowerBound
(Key key) lowerEntry
(Key key) Returns a key-value mapping associated with the greatest key strictly less than the given key, ornull
if there is no such key.final Key
Returns the greatest key strictly less than the given key, ornull
if there is no such key.final NavigableSet<Key>
Returns aNavigableSet
view of the keys contained in this map.static <Key,
T> QMap<Key, T> of
(Key k1, T t1) Returns a QMap containing a single mapping.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2) Returns a QMap containing two mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3) Returns a QMap containing three mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4) Returns a QMap containing four mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5) Returns a QMap containing five mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6) Returns a QMap containing six mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7) Returns a QMap containing seven mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8) Returns a QMap containing eight mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8, Key k9, T t9) Returns a QMap containing nine mappings.static <Key,
T> QMap<Key, T> of
(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8, Key k9, T t9, Key k10, T t10) Returns a QMap containing ten mappings.static <Key,
T> QMap<Key, T> ofEntries
(Map.Entry<? extends Key, ? extends T> entry0, Map.Entry<? extends Key, ? extends T>... entries) Returns a QMap containing keys and values extracted from the given entries.static <Key,
T> QMap<Key, T> Returns a QMap containing keys and values extracted from the given pairs.Removes and returns a key-value mapping associated with the least key in this map, ornull
if the map is empty.Removes and returns a key-value mapping associated with the greatest key in this map, ornull
if the map is empty.final T
Associates the specified value with the specified key in this map.final void
Copies all of the mappings from the specified map to this map.void
readFrom
(QDataStream stream) final T
Removes the mapping for a key from this map if it is present.final int
final int
removeIf
(BiPredicate<Key, T> predicate) final int
final int
size()
final NavigableMap<Key,
T> Returns a view of the portion of this map whose keys range fromfromKey
totoKey
.final NavigableMap<Key,
T> Equivalent tosubMap(fromKey, true, toKey, false)
.final NavigableMap<Key,
T> Equivalent totailMap(fromKey, true)
.final NavigableMap<Key,
T> Returns a view of the portion of this map whose keys are greater than (or equal to, ifinclusive
is true)fromKey
.final T
SeeQMap::
take(Key) toString()
Returns the string representation of the object given byQVariant(this).toString()
.final QAssociativeConstIterator<Key,
T> upperBound
(Key key) final T
final T
values()
void
writeTo
(QDataStream stream) Methods inherited from class io.qt.QtObject
dispose, isDisposed
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyType
- the type KvalueMetaType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueMetaType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueMetaType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueMetaType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyType
- the type KvalueType
- the type V
-
QMap
Creating a container with given content.- Parameters:
other
- map
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyType
- the type KvalueMetaType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueType
- the type V
-
QMap
Creating a container with given key and value type.See
QMap::
QMap() - Parameters:
keyMetaType
- the type KvalueMetaType
- the type V
-
-
Method Details
-
createVariantMap
-
clone
Creates and returns a copy of this object. -
clear
See
QMap::
clear() -
contains
-
count
-
count
-
begin
Provides a mutable C++ iterator to the containers begin.See
QMap::
begin() - Returns:
- begin
-
end
Provides a mutable C++ iterator to the containers end.See
QMap::
end() - Returns:
- end
-
constBegin
Provides a constant C++ iterator to the containers begin.- Returns:
- begin
-
constEnd
Provides a constant C++ iterator to the containers end.- Returns:
- end
-
find
- Returns:
- iterator
-
first
-
firstKey
-
insert
-
isEmpty
-
key
-
key
-
keys
Returns aList
of the keys contained in this associative container.- Returns:
- list of keys
-
keys
-
last
-
lastKey
-
lowerBound
-
removeIf
-
removeIf
-
removeAll
-
size
-
take
See
QMap::
take(Key) -
upperBound
-
value
-
value
-
values
-
equals
-
hashCode
Returns the objects's hash code computed byqHash(QMap<Key,T>)
. -
toString
Returns the string representation of the object given byQVariant(this).toString()
.- Returns:
- String
-
comparator
Returns the maps comparator.- Specified by:
comparator
in interfaceSortedMap<Key,
T>
-
containsKey
Returnstrue
if this map contains a mapping for the specified key.- Specified by:
containsKey
in interfaceMap<Key,
T> - See Also:
-
get
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key. -
put
Associates the specified value with the specified key in this map. -
remove
Removes the mapping for a key from this map if it is present. -
containsValue
Returnstrue
if this map maps one or more keys to the specified value.- Specified by:
containsValue
in interfaceMap<Key,
T> - See Also:
-
writeTo
-
readFrom
-
of
Returns a QMap containing a single mapping.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the mapping's keyt1
- the mapping's value- Returns:
- a
QMap
containing the specified mapping - Throws:
NullPointerException
- if the key or the value isnull
-
of
Returns a QMap containing two mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
Returns a QMap containing three mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
Returns a QMap containing four mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5) Returns a QMap containing five mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6) Returns a QMap containing six mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's valuek6
- the sixth mapping's keyt6
- the sixth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7) Returns a QMap containing seven mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's valuek6
- the sixth mapping's keyt6
- the sixth mapping's valuek7
- the seventh mapping's keyt7
- the seventh mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8) Returns a QMap containing eight mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's valuek6
- the sixth mapping's keyt6
- the sixth mapping's valuek7
- the seventh mapping's keyt7
- the seventh mapping's valuek8
- the eighth mapping's keyt8
- the eighth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8, Key k9, T t9) Returns a QMap containing nine mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's valuek6
- the sixth mapping's keyt6
- the sixth mapping's valuek7
- the seventh mapping's keyt7
- the seventh mapping's valuek8
- the eighth mapping's keyt8
- the eighth mapping's valuek9
- the ninth mapping's keyt9
- the ninth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
of
public static <Key,T> QMap<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4, Key k5, T t5, Key k6, T t6, Key k7, T t7, Key k8, T t8, Key k9, T t9, Key k10, T t10) Returns a QMap containing ten mappings.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
k1
- the first mapping's keyt1
- the first mapping's valuek2
- the second mapping's keyt2
- the second mapping's valuek3
- the third mapping's keyt3
- the third mapping's valuek4
- the fourth mapping's keyt4
- the fourth mapping's valuek5
- the fifth mapping's keyt5
- the fifth mapping's valuek6
- the sixth mapping's keyt6
- the sixth mapping's valuek7
- the seventh mapping's keyt7
- the seventh mapping's valuek8
- the eighth mapping's keyt8
- the eighth mapping's valuek9
- the ninth mapping's keyt9
- the ninth mapping's valuek10
- the tenth mapping's keyt10
- the tenth mapping's value- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any key or value isnull
-
ofEntries
@SafeVarargs public static <Key,T> QMap<Key,T> ofEntries(Map.Entry<? extends Key, ? extends T> entry0, Map.Entry<? extends Key, ? extends T>... entries) Returns a QMap containing keys and values extracted from the given entries.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
entries
-java.util.Map.Entry
s containing the keys and values from which the map is populated- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any entry, key, or value isnull
, or if theentries
array isnull
-
ofPairs
@SafeVarargs public static <Key,T> QMap<Key,T> ofPairs(QPair<? extends Key, ? extends T> pair0, QPair<? extends Key, ? extends T>... pairs) Returns a QMap containing keys and values extracted from the given pairs.- Type Parameters:
Key
- theQMap
's key typeT
- theQMap
's value type- Parameters:
pairs
-QPair
s containing the keys and values from which the map is populated- Returns:
- a
QMap
containing the specified mappings - Throws:
NullPointerException
- if any pair, key, or value isnull
, or if thepairs
array isnull
-
subMap
Equivalent to
subMap(fromKey, true, toKey, false)
. -
headMap
Equivalent to
headMap(toKey, false)
. -
tailMap
Equivalent to
tailMap(fromKey, true)
. -
lowerEntry
Returns a key-value mapping associated with the greatest key strictly less than the given key, ornull
if there is no such key.- Specified by:
lowerEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
lowerKey
Returns the greatest key strictly less than the given key, ornull
if there is no such key.- Specified by:
lowerKey
in interfaceNavigableMap<Key,
T> - See Also:
-
floorEntry
Returns a key-value mapping associated with the greatest key less than or equal to the given key, ornull
if there is no such key.- Specified by:
floorEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
floorKey
Returns the greatest key less than or equal to the given key, ornull
if there is no such key.- Specified by:
floorKey
in interfaceNavigableMap<Key,
T> - See Also:
-
ceilingEntry
Returns a key-value mapping associated with the least key greater than or equal to the given key, ornull
if there is no such key.- Specified by:
ceilingEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
ceilingKey
Returns the least key greater than or equal to the given key, ornull
if there is no such key.- Specified by:
ceilingKey
in interfaceNavigableMap<Key,
T> - See Also:
-
higherEntry
Returns a key-value mapping associated with the least key strictly greater than the given key, ornull
if there is no such key.- Specified by:
higherEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
higherKey
Returns the least key strictly greater than the given key, ornull
if there is no such key.- Specified by:
higherKey
in interfaceNavigableMap<Key,
T> - See Also:
-
firstEntry
Returns a key-value mapping associated with the least key in this map, ornull
if the map is empty.- Specified by:
firstEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
lastEntry
Returns a key-value mapping associated with the greatest key in this map, ornull
if the map is empty.- Specified by:
lastEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
pollFirstEntry
Removes and returns a key-value mapping associated with the least key in this map, ornull
if the map is empty.- Specified by:
pollFirstEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
pollLastEntry
Removes and returns a key-value mapping associated with the greatest key in this map, ornull
if the map is empty.- Specified by:
pollLastEntry
in interfaceNavigableMap<Key,
T> - See Also:
-
descendingMap
Returns a reverse order view of the mappings contained in this map.- Specified by:
descendingMap
in interfaceNavigableMap<Key,
T> - See Also:
-
descendingKeySet
Returns a reverse orderNavigableSet
view of the keys contained in this map. The set's iterator returns the keys in descending order.- Specified by:
descendingKeySet
in interfaceNavigableMap<Key,
T> - See Also:
-
subMap
@QtUninvokable public final NavigableMap<Key,T> subMap(Key fromKey, boolean fromInclusive, Key toKey, boolean toInclusive) Returns a view of the portion of this map whose keys range fromfromKey
totoKey
. IffromKey
andtoKey
are equal, the returned map is empty unlessfromInclusive
andtoInclusive
are both true. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.- Specified by:
subMap
in interfaceNavigableMap<Key,
T> - See Also:
-
headMap
Returns a view of the portion of this map whose keys are less than (or equal to, ifinclusive
is true)toKey
. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.- Specified by:
headMap
in interfaceNavigableMap<Key,
T> - See Also:
-
tailMap
Returns a view of the portion of this map whose keys are greater than (or equal to, ifinclusive
is true)fromKey
. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa.- Specified by:
tailMap
in interfaceNavigableMap<Key,
T> - See Also:
-
putAll
Copies all of the mappings from the specified map to this map. -
iterator
Returns an iterator over elements of typeQPair<K,V>
. -
entrySet
Returns aSet
view of the mappings contained in this map. -
keySet
Returns aSet
view of the keys contained in this map.
-