List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:org.openmrs.web.taglib.GlobalPropertyTag.java
public int doStartTag() { Object value;/*from ww w. ja va2 s .c o m*/ if (StringUtils.hasText(listSeparator)) { value = Collections.singletonList(defaultValue); } else { value = defaultValue; } if (StringUtils.hasText(listSeparator)) { String stringVal = (String) Context.getAdministrationService().getGlobalProperty(key, defaultValue); if (stringVal.trim().length() == 0) { value = Collections.emptyList(); } else { value = Arrays.asList(stringVal.split(listSeparator)); } } else { value = (String) Context.getAdministrationService().getGlobalProperty(key, defaultValue); } try { if (var != null) { pageContext.setAttribute(var, value); } else { pageContext.getOut().write(value.toString()); } } catch (Exception e) { log.error("error getting global property", e); } return SKIP_BODY; }
From source file:com.gargoylesoftware.htmlunit.util.DebuggingWebConnectionTest.java
/** * @throws Exception if the test fails/*w w w . ja v a2s . c om*/ */ @Test public void nameValueListToJsMap() throws Exception { assertEquals("{}", DebuggingWebConnection.nameValueListToJsMap(null)); final List<NameValuePair> emptyList = Collections.emptyList(); assertEquals("{}", DebuggingWebConnection.nameValueListToJsMap(emptyList)); List<NameValuePair> list = Collections.singletonList(new NameValuePair("name", "value")); assertEquals("{'name': 'value'}", DebuggingWebConnection.nameValueListToJsMap(list)); list = Collections.singletonList(new NameValuePair("na me", "value")); assertEquals("{'na me': 'value'}", DebuggingWebConnection.nameValueListToJsMap(list)); list = new ArrayList<>(); list.add(new NameValuePair("na me", "value1")); list.add(new NameValuePair("key", "value 2")); list.add(new NameValuePair("key 2", "value 3")); list.add(new NameValuePair("key 4", "with ' quote")); // can it really happen in header? final String expected = "{'na me': 'value1', 'key': 'value 2', 'key 2': 'value 3', 'key 4': 'with \\' quote'}"; assertEquals(expected, DebuggingWebConnection.nameValueListToJsMap(list)); }
From source file:com.synopsys.integration.executable.Executable.java
public static Executable create(final File workingDirectory, Map<String, String> environmentVariables, File executableFile) {//from w w w . j a va 2s .c o m return create(workingDirectory, environmentVariables, executableFile.getAbsolutePath(), Collections.emptyList()); }
From source file:com.hortonworks.streamline.streams.cluster.register.impl.HBaseServiceRegistrar.java
@Override protected List<ServiceConfiguration> createServiceConfigurations(Config config) { return Collections.emptyList(); }
From source file:de.brendamour.jpasskit.PWAssociatedApp.java
public List<String> getValidationErrors() { return Collections.emptyList(); }
From source file:eu.over9000.cathode.data.parameters.Direction.java
@Override public List<NameValuePair> buildParamPairs() { if (direction == null) { return Collections.emptyList(); }/*from ww w .j a v a2s. c om*/ return Collections.singletonList(new BasicNameValuePair("direction", direction.name())); }
From source file:com.navercorp.pinpoint.web.vo.stat.chart.DownSamplerTestBase.java
@Test public void sampler_should_return_default_value() { // Given//from w w w . j av a2 s . c om final List<T> samples = Collections.emptyList(); // When T min = sampler.sampleMin(samples); T max = sampler.sampleMax(samples); double avg = sampler.sampleAvg(samples); double roundedAvg = sampler.sampleAvg(samples, NUM_DECIMALS_FOR_ROUNDED_AVG); // Then Assert.assertEquals(DEFAULT_VALUE, min.intValue()); Assert.assertEquals(DEFAULT_VALUE, max.intValue()); Assert.assertEquals(DEFAULT_VALUE, avg, DOUBLE_COMPARISON_DELTA); Assert.assertEquals(DEFAULT_VALUE, roundedAvg, NUM_DECIMALS_FOR_ROUNDED_AVG); }
From source file:org.hawkular.apm.api.model.analytics.ServiceDeployment.java
/** * Creates a new Service Deployment, based on the given name and list of build stamps. * @param name the service name. Required. * @param buildStamps the list of build stamps. Optional. *//*ww w . j ava2 s .c o m*/ public ServiceDeployment(String name, List<BuildStamp> buildStamps) { if (null == name || name.isEmpty()) { throw new IllegalStateException("The service name cannot be null nor empty."); } if (null == buildStamps) { buildStamps = Collections.emptyList(); } this.name = name; this.buildStamps = buildStamps; }
From source file:com.thoughtworks.go.spark.RoutesHelper.java
private RoutesHelper(SparkSpringController[] controllers, SparkController[] apiControllers) { this.controllers = controllers == null ? Collections.emptyList() : Arrays.asList(controllers); this.sparkControllers = apiControllers == null ? Collections.emptyList() : Arrays.asList(apiControllers); }
From source file:cd.go.authentication.ldap.utils.Util.java
public static List<String> splitIntoLinesAndTrimSpaces(String lines) { if (StringUtils.isBlank(lines)) { return Collections.emptyList(); }//from w w w . jav a 2s . c om return Arrays.asList(lines.split("\\s*[\r\n]+\\s*")); }