Module qtjambi
Package io.qt.core

Class QHash<Key,T>

java.lang.Object
io.qt.QtObject
io.qt.core.QHash<Key,T>
All Implemented Interfaces:
QtObjectInterface, Cloneable, Iterable<QPair<Key,T>>, Map<Key,T>

public class QHash<Key,T> extends QtObject implements Map<Key,T>, Cloneable

Java wrapper for Qt class QHash

  • Constructor Details

    • QHash

      public QHash(Class<Key> keyType, Class<T> valueType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyType - the type K
      valueType - the type V
    • QHash

      public QHash(Map<Key,T> other)
      Creating a container with given content.

      See QHash::QHash(const QHash<Key, T> &)

      Parameters:
      other - map
    • QHash

      public QHash(Class<Key> keyType, QMetaType valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyType - the type K
      valueMetaType - the type V
    • QHash

      public QHash(QMetaType keyMetaType, Class<T> valueType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueType - the type V
    • QHash

      public QHash(Class<Key> keyType, QMetaType.Type valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyType - the type K
      valueMetaType - the type V
    • QHash

      public QHash(QMetaType.Type keyMetaType, Class<T> valueType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueType - the type V
    • QHash

      public QHash(QMetaType.Type keyMetaType, QMetaType valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueMetaType - the type V
    • QHash

      public QHash(QMetaType keyMetaType, QMetaType.Type valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueMetaType - the type V
    • QHash

      public QHash(QMetaType.Type keyMetaType, QMetaType.Type valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueMetaType - the type V
    • QHash

      public QHash(QMetaType keyMetaType, QMetaType valueMetaType)
      Creating a container with given key and value type.

      See QHash::QHash()

      Parameters:
      keyMetaType - the type K
      valueMetaType - the type V
  • Method Details

    • createVariantHash

      public static QHash<String,Object> createVariantHash()
      Creating a QHash with QVariant type (QHash<QString,QVariant>).

      See QHash::QHash()

    • clone

      public QHash<Key,T> clone()
      Creates and returns a copy of this object.

      See QHash::QHash(const QHash<Key, T> &)

    • capacity

      @QtUninvokable public final int capacity()
    • clear

      @QtUninvokable public final void clear()
      Specified by:
      clear in interface Map<Key,T>
    • contains

      @QtUninvokable public final boolean contains(Key key)
    • count

      @QtUninvokable public final int count()
    • count

      @QtUninvokable public final int count(Key key)
    • constEnd

      @QtUninvokable protected final QAssociativeConstIterator<Key,T> constEnd()
      Provides a constant C++ iterator to the containers end.

      See QHash::constEnd()const

      Returns:
      end
    • constBegin

      @QtUninvokable protected final QAssociativeConstIterator<Key,T> constBegin()
      Provides a constant C++ iterator to the containers begin.

      See QHash::constBegin()const

      Returns:
      begin
    • end

      @QtUninvokable protected final QAssociativeIterator<Key,T> end()
      Provides a mutable C++ iterator to the containers end.

      See QHash::end()

      Returns:
      end
    • begin

      @QtUninvokable protected final QAssociativeIterator<Key,T> begin()
      Provides a mutable C++ iterator to the containers begin.

      See QHash::begin()

      Returns:
      begin
    • find

      @QtUninvokable public final QAssociativeConstIterator<Key,T> find(Key key)
      Returns:
      iterator
    • insert

      @QtUninvokable public final void insert(Key key, T value)
    • isEmpty

      @QtUninvokable public final boolean isEmpty()
      Specified by:
      isEmpty in interface Map<Key,T>
      Returns:
      true if this container contains no elements
    • key

      @QtUninvokable public final Key key(T value)
    • key

      @QtUninvokable public final Key key(T value, Key defaultKey)
    • keys

      @QtUninvokable public final QList<Key> keys()
      Returns a List of the keys contained in this associative container.

      See QHash::keys()const

      Returns:
      list of keys
    • keys

      @QtUninvokable public final QList<Key> keys(T value)
    • removeIf

      @QtUninvokable public final int removeIf(Predicate<Key> predicate)
    • removeIf

      @QtUninvokable public final int removeIf(BiPredicate<Key,T> predicate)
    • removeAll

      @QtUninvokable public final int removeAll(Object key)
    • reserve

      @QtUninvokable public final void reserve(int size)
    • size

      @QtUninvokable public final int size()
      Specified by:
      size in interface Map<Key,T>
      Returns:
      the number of elements in this container
    • squeeze

      @QtUninvokable public final void squeeze()
    • take

      @QtUninvokable public final T take(Key key)
    • value

      @QtUninvokable public final T value(Key key)
    • value

      @QtUninvokable public final T value(Key key, T defaultValue)
    • values

      @QtUninvokable public final QList<T> values()
      Specified by:
      values in interface Map<Key,T>
    • equals

      @QtUninvokable public boolean equals(Object other)
      Specified by:
      equals in interface Map<Key,T>
      Overrides:
      equals in class QtObject
      Parameters:
      other - other object
      Returns:
      true if the native counterpart of the two objects are one and the same.
    • hashCode

      @QtUninvokable public int hashCode()
      Returns the objects's hash code computed by qHash(QHash<Key,T>).
      Specified by:
      hashCode in interface Map<Key,T>
      Overrides:
      hashCode in class Object
    • toString

      @QtUninvokable public String toString()
      Returns the string representation of the object given by QVariant(this).toString().
      Returns:
      String
    • containsKey

      @QtUninvokable public final boolean containsKey(Object key)
      Returns true if this map contains a mapping for the specified key.
      Specified by:
      containsKey in interface Map<Key,T>
      See Also:
    • get

      @QtUninvokable public final T get(Object key)
      Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
      Specified by:
      get in interface Map<Key,T>
      See Also:
    • put

      @QtUninvokable public final T put(Key key, T value)
      Associates the specified value with the specified key in this map.
      Specified by:
      put in interface Map<Key,T>
      See Also:
    • remove

      @QtUninvokable public final T remove(Object key)
      Removes the mapping for a key from this map if it is present.
      Specified by:
      remove in interface Map<Key,T>
      See Also:
    • containsValue

      @QtUninvokable public final boolean containsValue(Object value)
      Returns true if this map maps one or more keys to the specified value.
      Specified by:
      containsValue in interface Map<Key,T>
      See Also:
    • writeTo

      @QtUninvokable public void writeTo(QDataStream stream)
    • readFrom

      @QtUninvokable public void readFrom(QDataStream stream)
    • of

      public static <Key, T> QHash<Key,T> of(Key k1, T t1)
      Returns a QHash containing a single mapping.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the mapping's key
      t1 - the mapping's value
      Returns:
      a QHash containing the specified mapping
      Throws:
      NullPointerException - if the key or the value is null
    • of

      public static <Key, T> QHash<Key,T> of(Key k1, T t1, Key k2, T t2)
      Returns a QHash containing two mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3)
      Returns a QHash containing three mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<Key,T> of(Key k1, T t1, Key k2, T t2, Key k3, T t3, Key k4, T t4)
      Returns a QHash containing four mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing five mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing six mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      k6 - the sixth mapping's key
      t6 - the sixth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing seven mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      k6 - the sixth mapping's key
      t6 - the sixth mapping's value
      k7 - the seventh mapping's key
      t7 - the seventh mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing eight mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      k6 - the sixth mapping's key
      t6 - the sixth mapping's value
      k7 - the seventh mapping's key
      t7 - the seventh mapping's value
      k8 - the eighth mapping's key
      t8 - the eighth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing nine mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      k6 - the sixth mapping's key
      t6 - the sixth mapping's value
      k7 - the seventh mapping's key
      t7 - the seventh mapping's value
      k8 - the eighth mapping's key
      t8 - the eighth mapping's value
      k9 - the ninth mapping's key
      t9 - the ninth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • of

      public static <Key, T> QHash<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 QHash containing ten mappings.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      k1 - the first mapping's key
      t1 - the first mapping's value
      k2 - the second mapping's key
      t2 - the second mapping's value
      k3 - the third mapping's key
      t3 - the third mapping's value
      k4 - the fourth mapping's key
      t4 - the fourth mapping's value
      k5 - the fifth mapping's key
      t5 - the fifth mapping's value
      k6 - the sixth mapping's key
      t6 - the sixth mapping's value
      k7 - the seventh mapping's key
      t7 - the seventh mapping's value
      k8 - the eighth mapping's key
      t8 - the eighth mapping's value
      k9 - the ninth mapping's key
      t9 - the ninth mapping's value
      k10 - the tenth mapping's key
      t10 - the tenth mapping's value
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any key or value is null
    • ofEntries

      @SafeVarargs public static <Key, T> QHash<Key,T> ofEntries(Map.Entry<? extends Key,? extends T> entry0, Map.Entry<? extends Key,? extends T>... entries)
      Returns a QHash containing keys and values extracted from the given entries.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      entries - java.util.Map.Entrys containing the keys and values from which the map is populated
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any entry, key, or value is null, or if the entries array is null
    • ofPairs

      @SafeVarargs public static <Key, T> QHash<Key,T> ofPairs(QPair<? extends Key,? extends T> pair0, QPair<? extends Key,? extends T>... pairs)
      Returns a QHash containing keys and values extracted from the given pairs.
      Type Parameters:
      Key - the QHash's key type
      T - the QHash's value type
      Parameters:
      pairs - QPairs containing the keys and values from which the map is populated
      Returns:
      a QHash containing the specified mappings
      Throws:
      NullPointerException - if any entry, key, or value is null, or if the entries array is null
    • putAll

      @QtUninvokable public final void putAll(Map<? extends Key,? extends T> m)
      Copies all of the mappings from the specified map to this map.
      Specified by:
      putAll in interface Map<Key,T>
    • iterator

      @QtUninvokable public final Iterator<QPair<Key,T>> iterator()
      Returns an iterator over elements of type QPair<K,V>.
      Specified by:
      iterator in interface Iterable<Key>
      Returns:
      an Iterator
    • entrySet

      @QtUninvokable public final Set<Map.Entry<Key,T>> entrySet()
      Returns a Set view of the mappings contained in this map.
      Specified by:
      entrySet in interface Map<Key,T>
    • keySet

      @QtUninvokable public final Set<Key> keySet()
      Returns a Set view of the keys contained in this map.
      Specified by:
      keySet in interface Map<Key,T>