Example usage for java.util Collections singleton

List of usage examples for java.util Collections singleton

Introduction

In this page you can find the example usage for java.util Collections singleton.

Prototype

public static <T> Set<T> singleton(T o) 

Source Link

Document

Returns an immutable set containing only the specified object.

Usage

From source file:fr.mael.microrss.util.DozerConverter.java

/**
 * Each object can be converted/*www .  j ava  2  s.c  o m*/
 */
public Set<ConvertiblePair> getConvertibleTypes() {
    return Collections.singleton(new ConvertiblePair(Object.class, Object.class));
}

From source file:Main.java

public static CertPathParameters getCertPathParameters() throws InvalidAlgorithmParameterException {
    if ((rootCertificateSS == null) || (theCertSelector == null) || (builder == null)) {
        throw new RuntimeException("Call initCertPathSSCertChain prior to buildCertPath");
    }/*from   w w w .  ja va  2s  .  com*/
    PKIXBuilderParameters buildParams = new PKIXBuilderParameters(
            Collections.singleton(new TrustAnchor(rootCertificateSS, null)), theCertSelector);

    buildParams.addCertStore(store);
    buildParams.setRevocationEnabled(false);

    return buildParams;

}

From source file:org.gridobservatory.greencomputing.dao.MiddlewareDao.java

@Override
public void insert(Middleware middleware) {
    this.insert(Collections.singleton(middleware));
}

From source file:org.openmhealth.dsu.domain.EndUserUserDetails.java

public EndUserUserDetails(String username, String password) {
    super(username, password, Collections.singleton(new SimpleGrantedAuthority(END_USER_ROLE)));
}

From source file:org.gridobservatory.greencomputing.dao.MotherboardDao.java

@Override
public void insert(Motherboard motherboard) {
    this.insert(Collections.singleton(motherboard));
}

From source file:org.gridobservatory.greencomputing.dao.SensorDao.java

@Override
public void insert(SensorType sensor) {
    this.insert(Collections.singleton(sensor));
}

From source file:me.ferrybig.javacoding.webmapper.test.session.DefaultDataStorageTest.java

@Test
public void getDataAsSupportsOneBackendTypeTest() {
    Object o;//from  www .  j  a v  a  2  s . co m
    data.setData(Collections.singleton(o = new Object()));
    assertEquals(o, extr(data.getDataAs(Object.class)));
}

From source file:zipkin.autoconfigure.metrics.PrometheusMetricsAutoConfigurationTest.java

@Test
public void correctHttpResponse() throws Exception {
    PublicMetrics publicMetrics = () -> Collections.singleton(new Metric<Number>("mem.free", 1024));
    ResponseEntity<String> response = responseForMetrics(publicMetrics);

    assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
    assertThat(response.getHeaders().getContentType().toString(),
            equalTo("text/plain;version=0.0.4;charset=utf-8"));
}

From source file:sample.web.velocity.WelcomeController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public String view(Map<String, Object> model) throws JsonProcessingException {
    final Bean bean = new Bean("hey", Collections.singleton("1"), Collections.singletonMap("sh", "<"));
    model.put("head", "Change me");
    model.put("bean", bean);
    return "welcome";
}

From source file:io.twipple.springframework.data.clusterpoint.convert.support.ConversionUtils.java

/**
 * Returns a collection from the given source object.
 *
 * @param source the source object.//  w  w w .j  av  a  2 s. c o m
 * @return the target collection.
 */
@NotNull
public static Collection<?> asCollection(@NotNull Object source) {

    Assert.notNull(source);

    if (source instanceof Collection) {
        return (Collection<?>) source;
    }

    if (source.getClass().isArray()) {
        return CollectionUtils.arrayToList(source);
    }

    return Collections.singleton(source);
}