Package com.badlogic.gdx.maps
Class MapProperties
- java.lang.Object
-
- com.badlogic.gdx.maps.MapProperties
-
public class MapProperties extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MapProperties()Creates an empty properties set
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all propertiesbooleancontainsKey(java.lang.String key)java.lang.Objectget(java.lang.String key)<T> Tget(java.lang.String key, java.lang.Class<T> clazz)Returns the object for the given key, casting it to clazz.<T> Tget(java.lang.String key, T defaultValue, java.lang.Class<T> clazz)Returns the object for the given key, casting it to clazz.java.util.Iterator<java.lang.String>getKeys()java.util.Iterator<java.lang.Object>getValues()voidput(java.lang.String key, java.lang.Object value)voidputAll(MapProperties properties)voidremove(java.lang.String key)
-
-
-
Method Detail
-
containsKey
public boolean containsKey(java.lang.String key)
- Parameters:
key- property name- Returns:
- true if and only if the property exists
-
get
public java.lang.Object get(java.lang.String key)
- Parameters:
key- property name- Returns:
- the value for that property if it exists, otherwise, null
-
get
public <T> T get(java.lang.String key, java.lang.Class<T> clazz)Returns the object for the given key, casting it to clazz.- Parameters:
key- the key of the objectclazz- the class of the object- Returns:
- the object or null if the object is not in the map
- Throws:
java.lang.ClassCastException- if the object with the given key is not of type clazz
-
get
public <T> T get(java.lang.String key, T defaultValue, java.lang.Class<T> clazz)Returns the object for the given key, casting it to clazz.- Parameters:
key- the key of the objectdefaultValue- the default valueclazz- the class of the object- Returns:
- the object or the defaultValue if the object is not in the map
- Throws:
java.lang.ClassCastException- if the object with the given key is not of type clazz
-
put
public void put(java.lang.String key, java.lang.Object value)- Parameters:
key- property namevalue- value to be inserted or modified (if it already existed)
-
putAll
public void putAll(MapProperties properties)
- Parameters:
properties- set of properties to be added
-
remove
public void remove(java.lang.String key)
- Parameters:
key- property name to be removed
-
clear
public void clear()
Removes all properties
-
getKeys
public java.util.Iterator<java.lang.String> getKeys()
- Returns:
- iterator for the property names
-
getValues
public java.util.Iterator<java.lang.Object> getValues()
- Returns:
- iterator to properties' values
-
-