Example usage for com.badlogic.gdx.utils ObjectMap get

List of usage examples for com.badlogic.gdx.utils ObjectMap get

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils ObjectMap get.

Prototype

public V get(K key, V defaultValue) 

Source Link

Document

Returns the value for the specified key, or the default value if the key is not in the map.

Usage

From source file:com.badlogic.gdx.tests.g3d.ShaderLoader.java

License:Apache License

protected void load(final StringBuilder out, final String name) {
    final int idx = name.lastIndexOf(':');
    final String fileName = idx < 0 ? name : name.substring(0, idx);
    final String snipName = idx < 0 || (idx >= name.length() - 1) ? "" : name.substring(idx + 1);
    ObjectMap<String, String> snips = snippets.get(fileName, null);
    if (snips == null) {
        snips = parse(root.child(fileName));
        snippets.put(fileName, snips);/*from   ww  w .ja  v a2  s  .com*/
    }
    String result = snips.get(snipName, null);
    if (result == null)
        throw new GdxRuntimeException("No snippet [" + snipName + "] in file " + root.child(fileName).path());
    parse(out, fileName, result);
}