List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:eu.stratosphere.api.common.operators.util.FieldList.java
public FieldList(int fieldId) { super(Collections.singletonList(fieldId)); }
From source file:de.tu.darmstadt.lt.ner.feature.extractor.CamelCaseFeatureExtractor.java
@Override public List<Feature> apply(Feature feature) { Object featureValue = feature.getValue(); if (featureValue == null) { return Collections.singletonList(new Feature("CapsFeature", "CapsFeature_null")); }// w w w. j av a2s . c o m String value = featureValue.toString(); if (value == null || value.length() == 0) { return Collections.singletonList(new Feature("CapsFeature", "CapsFeature_null")); } if (StringUtils.isAllUpperCase(value)) { return Collections .singletonList(new Feature("CapsFeature", StringUtils.capitalize(value.toLowerCase()))); } else { return Collections.singletonList(new Feature("CapsFeature", value)); } }
From source file:greenpages.internal.DirectoryImpl.java
/** * {@inheritDoc}/*from w w w . ja va 2 s. co m*/ * * Stub implementation will match only for term '<code>johnson</code>'. */ public List<Listing> search(String term) { if (ROD_JOHNSON.getLastName().equalsIgnoreCase(term)) { Listing l = ROD_JOHNSON; return Collections.singletonList(l); } else { return Collections.emptyList(); } }
From source file:Main.java
private static List<Camera.Area> buildMiddleArea(int areaPer1000) { return Collections .singletonList(new Camera.Area(new Rect(-areaPer1000, -areaPer1000, areaPer1000, areaPer1000), 1)); }
From source file:com.liferay.ide.bndtools.core.templates.AbstractProjectTemplate.java
public void modifyInitialBndModel(BndEditModel model, String projectName, ProjectPaths projectPaths) { model.setBundleVersion("1.0.0.${tstamp}"); model.setBundleDescription(safeJavaClassName(projectName)); model.setExportedPackages(//from w w w. ja v a 2s . co m Collections.singletonList(new ExportedPackage(safePackageName(projectName), Attrs.EMPTY_ATTRS))); }
From source file:com.evrythng.thng.resource.model.exception.ErrorMessage.java
/** * Creates a new ErrorMessage containing a single human-friendly description * message./* w w w . java 2s. c o m*/ */ public ErrorMessage(final int status, final String error) { this(status, Collections.singletonList(error)); }
From source file:com.create.application.configuration.EndpointsConfiguration.java
@Bean public List<String> h2Endpoints(@Value("${spring.h2.console.path}") String h2Endpoint) { return Collections.singletonList(getWildcardMappings(h2Endpoint)); }
From source file:org.commonjava.cartographer.result.ProjectPathTest.java
@Test public void jsonRoundTrip() throws Exception { ProjectVersionRef ref = new SimpleProjectVersionRef("org.foo", "bar", "1"); ProjectPath in = new ProjectPath(Collections.singletonList(new SimpleParentRelationship( URI.create("http://nowhere.com"), ref, new SimpleProjectVersionRef("org.dep", "project", "1.1")))); ObjectMapper mapper = new ObjectMapper(); mapper.registerModules(new ProjectVersionRefSerializerModule(), new ProjectRelationshipSerializerModule()); mapper.enable(SerializationFeature.INDENT_OUTPUT); String json = mapper.writeValueAsString(in); System.out.println(json);/*from ww w . j a v a 2s . c o m*/ ProjectPath out = mapper.readValue(json, ProjectPath.class); }
From source file:hudson.plugins.timestamper.TimestampFormatterTest.java
/** * @return parameterised test data// ww w . j ava 2s .co m */ @Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { Collections.singletonList("system"), "00:00:42 ", "08:00:42 " }, { Collections.singletonList("elapsed"), "00.123 ", "00.123 " }, { Collections.singletonList("none"), "", "" }, { Collections.emptyList(), "00:00:42 ", "08:00:42 " }, { null, "00:00:42 ", "08:00:42 " } }); }
From source file:edu.psu.swe.commons.jaxrs.RestResource.java
public static <T> RestResource<T> wrap(T dto, String type, AtomLink atomLink) { return wrap(dto, type, Collections.singletonList(atomLink)); }