Java Code Examples for java.util.Collections.emptyMap()

The following are Jave code examples for showing how to use emptyMap() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: NGB-master   File: ProjectDao.java   View Source Code Vote up 5 votes
/**
 * Loads ProjectItems for a list of specified projectIds
 * @param projectIds a List of Ids of projects to load ProjectItems
 * @return a Map of ProjectItems to project IDs
 */
@Transactional(propagation = Propagation.MANDATORY)
public Map<Long, Set<ProjectItem>> loadProjectItemsByProjectIds(List<Long> projectIds) {
    if (projectIds.isEmpty()) {
        return Collections.emptyMap();
    }

    Long listId = daoHelper.createTempLongList(projectIds);
    return loadProjectItemsByList(listId);
}
 
Example 2
Project: elasticsearch_my   File: GrokProcessorFactoryTests.java   View Source Code Vote up 5 votes
public void testCreateWithInvalidPattern() throws Exception {
    GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
    Map<String, Object> config = new HashMap<>();
    config.put("field", "_field");
    config.put("patterns", Collections.singletonList("["));
    ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, config));
    assertThat(e.getMessage(), equalTo("[patterns] Invalid regex pattern found in: [[]. premature end of char-class"));
}
 
Example 3
Project: visuflow-plugin   File: DebugStepResumeHandler.java   View Source Code Vote up 5 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	EventAdmin ea = ServiceUtil.getService(EventAdmin.class);
	Event stepOver = new Event(EA_TOPIC_DEBUGGING_ACTION_RESUME, Collections.emptyMap());
	ea.sendEvent(stepOver);

	// has to be null (see javadoc)
	return null;
}
 
Example 4
Project: page-content-tester   File: ConfigResolver.java   View Source Code Vote up 5 votes
private Map<String, String> getCookies(Cookie[] annotationCookies) {

        HashMap<String, String> cookies = new HashMap<>();

        for (Cookie annotationCookie : annotationCookies) {
            if (annotationCookie.name().isEmpty()) {
                return Collections.emptyMap();
            }
            cookies.put(annotationCookie.name(), annotationCookie.value());
        }
        return cookies;
    }
 
Example 5
Project: page-content-tester   File: ConfigResolver.java   View Source Code Vote up 5 votes
private Map<String, String> getHeaders(Header[] annotationHeaders) {

        HashMap<String, String> headers = new HashMap<>();

        for (Header annotationHeader : annotationHeaders) {
            if (annotationHeader.name().isEmpty()) {
                return Collections.emptyMap();
            }
            headers.put(annotationHeader.name(), annotationHeader.value());
        }
        return headers;
    }
 
Example 6
Project: ditb   File: OperationWithAttributes.java   View Source Code Vote up 5 votes
@Override
public Map<String, byte[]> getAttributesMap() {
  if (attributes == null) {
    return Collections.emptyMap();
  }
  return Collections.unmodifiableMap(attributes);
}
 
Example 7
Project: dhus-core   File: SortedMapTest.java   View Source Code Vote up 5 votes
/** Constructor: Empty map param. */
@Test
public void emptyMapTest()
{
   SortedMap sorted_map = new SortedMap(Collections.emptyMap(), cmp);
   Assert.assertTrue(sorted_map.isEmpty());
   Assert.assertEquals(sorted_map.size(), 0);
   Assert.assertFalse(sorted_map.keySet().iterator().hasNext());
   Assert.assertFalse(sorted_map.values().iterator().hasNext());
   Assert.assertFalse(sorted_map.entrySet().iterator().hasNext());
}
 
Example 8
Project: elasticsearch_my   File: ScriptContextTests.java   View Source Code Vote up 5 votes
public void testCustomScriptContextSettings() throws Exception {
    ScriptService scriptService = makeScriptService();
    Script script = new Script(ScriptType.INLINE, MockScriptEngine.NAME, "1", Collections.emptyMap());
    try {
        scriptService.compile(script, new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op"));
        fail("script compilation should have been rejected");
    } catch (IllegalStateException e) {
        assertTrue(e.getMessage(), e.getMessage().contains("scripts of type [inline], operation [" + PLUGIN_NAME + "_custom_exp_disabled_op] and lang [" + MockScriptEngine.NAME + "] are disabled"));
    }

    // still works for other script contexts
    assertNotNull(scriptService.compile(script, ScriptContext.Standard.AGGS));
    assertNotNull(scriptService.compile(script, ScriptContext.Standard.SEARCH));
    assertNotNull(scriptService.compile(script, new ScriptContext.Plugin(PLUGIN_NAME, "custom_op")));
}
 
Example 9
Project: airgram   File: TtmlSubtitle.java   View Source Code Vote up 5 votes
public TtmlSubtitle(TtmlNode root, Map<String, TtmlStyle> globalStyles,
    Map<String, TtmlRegion> regionMap) {
  this.root = root;
  this.regionMap = regionMap;
  this.globalStyles = globalStyles != null
      ? Collections.unmodifiableMap(globalStyles) : Collections.<String, TtmlStyle>emptyMap();
  this.eventTimesUs = root.getEventTimesUs();
}
 
Example 10
Project: alfresco-repository   File: ExtendedMailActionExecutor.java   View Source Code Vote up 5 votes
public Map<String, Object> getLastMessageTemplateModel()
{
    Object model = parameterValues.get(PARAM_TEMPLATE_MODEL);
    if (model instanceof Map)
    {
        return (Map<String, Object>) model;
    }
    else
    {
        String className = model == null ? "" : model.getClass().getName();
        LOGGER.warn("Skipping unsupported email template model parameters of type " + className);
    }
    return Collections.emptyMap();
}
 
Example 11
Project: de.flapdoodle.solid   File: MapExpression.java   View Source Code Vote up 4 votes
public MapExpression(int lineNumber) {
    this.entries = Collections.emptyMap();
    this.lineNumber = lineNumber;
}
 
Example 12
Project: L2J-Global   File: L2Character.java   View Source Code Vote up 4 votes
/**
 * @return the summon
 */
public Map<Integer, L2Summon> getServitors()
{
	return Collections.emptyMap();
}
 
Example 13
Project: MCBot   File: CommandCustomPing.java   View Source Code Vote up 4 votes
public Map<Long, List<CustomPing>> getPingsForGuild(IGuild guild) {
    if (storage == null) {
        return Collections.emptyMap();
    }
    return storage.get(guild);
}
 
Example 14
Project: kafka-javaee-concurrency-utilities   File: Consumer.java   View Source Code Vote up 4 votes
@Override
public Map<String, String> getExecutionProperties() {
    return Collections.emptyMap();
}
 
Example 15
Project: letv   File: g.java   View Source Code Vote up 4 votes
private g(byte b) {
    this.a = Collections.emptyMap();
}
 
Example 16
Project: Vanilla-Injection   File: StructureBlock.java   View Source Code Vote up 4 votes
@Override
public Map<String, String> getProperties() {
  return Collections.emptyMap();
}
 
Example 17
Project: Vanilla-Injection   File: SimpleBlockState.java   View Source Code Vote up 4 votes
public SimpleBlockState(String stringId, @Nullable TagCompound nbt) {
  this(stringId, Collections.emptyMap(), nbt);
}
 
Example 18
Project: incubator-netbeans   File: SCFTHandlerTest.java   View Source Code Vote up 4 votes
public void testCreateWithNameAndExtForForm() throws Exception {
    LocalFileSystem lfs = new LocalFileSystem();
    lfs.setRootDirectory(getWorkDir());
    FileObject root = lfs.getRoot();
    FileObject fo = FileUtil.createData(root, "j.java");
    OutputStream os = fo.getOutputStream();
    String txt = "print('<html><h1>', nameAndExt, '</h1></html>')";
    os.write(txt.getBytes());
    os.close();
    fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
    
    FileObject fo2 = FileUtil.createData(root, "j.form");
    OutputStream os2 = fo2.getOutputStream();
    String txt2 = "print('<html><h2>', nameAndExt, '</h2></html>')";
    os2.write(txt2.getBytes());
    os2.close();
    fo2.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js");
    
    DataObject obj = DataObject.find(fo);
    assertEquals("Both files", 2, obj.files().size());
    
    DataFolder folder = DataFolder.findFolder(FileUtil.createFolder(root, "target"));
    
    Map<String,String> parameters = Collections.emptyMap();
    DataObject n = obj.createFromTemplate(folder, "complex", parameters);
    
    assertEquals("Two files", 2, n.files().size());
    
    
    FileObject newForm = FileUtil.findBrother(n.getPrimaryFile(), "form");
    
    assertEquals("Primary file is java", "java", n.getPrimaryFile().getExt());
    
    assertNotNull("Form copied", newForm);
    DataObject frm = DataObject.find(newForm);
    assertSame("Form belongs to java", n, frm);
    
    assertEquals("Created in right place", folder, n.getFolder());
    assertEquals("Created with right name", "complex", n.getName());
    
    String exp = "<html><h1> complex.java </h1></html>\n";
    assertEquals("Primary file" + n.getPrimaryFile(), exp, readFile(n.getPrimaryFile()));
    
    String exp2 = "<html><h2> complex.form </h2></html>\n";
    assertEquals(exp2, readFile(newForm));
}
 
Example 19
Project: monarch   File: CacheDistributionAdvisor.java   View Source Code Vote up 4 votes
public InitialImageAdvice() {
  this(Collections.EMPTY_SET, Collections.EMPTY_SET, Collections.EMPTY_SET,
      Collections.EMPTY_SET, Collections.EMPTY_SET, Collections.EMPTY_SET,
      Collections.<InternalDistributedMember, CacheProfile>emptyMap());
}
 
Example 20
Project: ArchUnit   File: ImportTestUtils.java   View Source Code Vote up 4 votes
@Override
public Map<String, JavaAnnotation> createAnnotations(JavaClass owner) {
    return Collections.emptyMap();
}