List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:com.hp.autonomy.aci.content.fieldtext.NOTWILD.java
/** * Constructs a new single field NOTWILD fieldtext * @param field The field name/* w w w . jav a2 s . c om*/ * @param values The field values */ public NOTWILD(final String field, final Iterable<String> values) { this(Collections.singletonList(field), values); }
From source file:Lists.java
public static <T> List<T> add(List<T> list, T toAdd) { switch (list.size()) { case 0://from www. j av a 2 s. c o m // Empty -> Singleton return Collections.singletonList(toAdd); case 1: { // Singleton -> ArrayList List<T> result = new ArrayList<T>(2); result.add(list.get(0)); result.add(toAdd); return result; } default: // ArrayList list.add(toAdd); return list; } }
From source file:com.hp.autonomy.aci.content.fieldtext.MATCH.java
/** * Creates a new single field MATCH fieldtext * @param field The name of the field/* ww w .j a v a 2 s . c o m*/ * @param values The field values */ public MATCH(final String field, final Iterable<String> values) { this(Collections.singletonList(field), values); }
From source file:com.netflix.spinnaker.fiat.model.resources.ServiceAccount.java
@JsonIgnore public List<String> getRequiredGroupMembership() { // There is a potential here for a naming collision where service account // "my-svc-account@abc.com" and "my-svc-account@xyz.com" each allow one another's users to use // their service account. In practice, though, I don't think this will be an issue. return Collections.singletonList(StringUtils.substringBefore(name, "@")); }
From source file:com.hp.autonomy.aci.content.fieldtext.NOTSTRING.java
/** * Constructs a new single field NOTSTRING fieldtext * @param field The field name//from w w w . j a v a 2 s. c o m * @param values The field values */ public NOTSTRING(final String field, final Iterable<String> values) { this(Collections.singletonList(field), values); }
From source file:com.hp.autonomy.aci.content.fieldtext.STRINGALL.java
/** * Constructs a new single field STRINGALL fieldtext * @param field The field name/*from ww w. j a v a2 s .co m*/ * @param values The field values */ public STRINGALL(final String field, final Iterable<String> values) { this(Collections.singletonList(field), values); }
From source file:com.recursivechaos.clearent.service.ClearentService.java
public Transaction postTransaction(Transaction transaction) { RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Response> responseEntity; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); headers.set("api-key", gatewayProperties.getKey()); HttpEntity<String> request = new HttpEntity<>(transaction.toString(), headers); try {//from w ww . jav a 2s .co m responseEntity = restTemplate.postForEntity(gatewayProperties.getUrl() + "/transactions", request, Response.class); } catch (HttpClientErrorException he) { logger.error("Gateway Request Failed: {}", he.getLocalizedMessage()); logger.error(he.getResponseBodyAsString()); throw new GatewayException(he.getLocalizedMessage()); } assert responseEntity != null; return responseEntity.getBody().getPayload().getTransaction(); }
From source file:org.urlshortener.core.converter.UrlShortenerMessageConverter.java
public List<MediaType> getSupportedMediaTypes() { return Collections.singletonList(new MediaType("text", "plain")); }
From source file:com.hp.autonomy.aci.content.identifier.stateid.StateIdsBuilder.java
/** * Creates a {@code StateIdsBuilder} containing the specified state token and a single zero-based document index. * * @param stateToken The initial state token * @param document The specific document index *//*w w w . j av a 2 s . c o m*/ public StateIdsBuilder(final String stateToken, final int document) { doAppend(Collections.singletonList(new StateId(stateToken, document))); }
From source file:io.kahu.hawaii.util.call.http.response.AbstractHttpResponseHandler.java
public AbstractHttpResponseHandler(boolean mayReadPayload) { this(mayReadPayload, Collections.singletonList(HttpStatus.SC_OK)); }