Code example for ConcurrentMap

Methods: get

0
 
  private ConcurrentMap<String, String> items = new ConcurrentHashMap<String, String>();
 
  @Override 
  public Reader open(String name) throws IOException {
    String content = items.get(name);
    return content == null ? null : new StringReader(content);
  } 
 
  @Override 
  public Reader openOrFail(String name) throws JSilverTemplateNotFoundException, IOException {
    Reader reader = open(name);
    if (reader == null) {
      throw new JSilverTemplateNotFoundException(name);
    } else { 
      return reader;
    } 
  } 
 
  public void store(String name, String contents) {
    items.put(name, contents);