Example usage for java.util Collections emptyList

List of usage examples for java.util Collections emptyList

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public static final <T> List<T> emptyList() 

Source Link

Document

Returns an empty list (immutable).

Usage

From source file:com.spotify.styx.model.deprecated.WorkflowConfiguration.java

@JsonCreator
public static WorkflowConfiguration create(@JsonProperty("id") String id,
        @JsonProperty("partitioning") Schedule partitioning,
        @JsonProperty("docker_image") Optional<String> dockerImage,
        @JsonProperty("docker_args") Optional<List<String>> dockerArgs,
        @JsonProperty("docker_termination_logging") Optional<Boolean> dockerTerminationLogging,
        @JsonProperty("secret") Optional<Secret> secret, @JsonProperty("resources") List<String> resources) {

    return new AutoValue_WorkflowConfiguration(id, partitioning, dockerImage, dockerArgs,
            dockerTerminationLogging.orElse(false), secret,
            resources == null ? Collections.emptyList() : resources);
}

From source file:org.agorava.facebook.jackson.ReferenceListDeserializer.java

@SuppressWarnings("unchecked")
@Override/*from www  . j ava2 s .  c  om*/
public List<Reference> deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    ObjectMapper mapper = getInstance().resolve(ObjectMapper.class);
    jp.setCodec(mapper);
    if (jp.hasCurrentToken()) {
        JsonNode dataNode = (JsonNode) jp.readValueAs(JsonNode.class).get("data");
        if (dataNode != null) {
            return (List<Reference>) mapper.reader(new TypeReference<List<Reference>>() {
            }).readValue(dataNode);
        }
    }

    return Collections.emptyList();
}

From source file:org.cloudfoundry.dependency.out.OutAction.java

Mono<OutResponse> run() {
    return Mono.just(new OutResponse(Collections.emptyList(), new VersionReference("")));
}

From source file:com.alibaba.openapi.client.util.URLEncodedUtils.java

/**
 * Returns a list of {@link NameValuePair NameValuePairs} as parsed from an
 * {@link HttpEntity}. The encoding is taken from the entity's
 * Content-Encoding header./*from  ww  w . ja  va 2 s  .  c  o m*/
 * <p>
 * This is typically used while parsing an HTTP POST.
 * 
 * @param entity
 *            The entity to parse
 * @throws IOException
 *             If there was an exception getting the entity's data.
 */
public static List<NameValuePair> parse(final HttpEntity entity) throws IOException {
    List<NameValuePair> result = Collections.emptyList();
    if (isEncoded(entity)) {
        final String content = EntityUtils.toString(entity);
        final Header encoding = entity.getContentEncoding();
        if (content != null && content.length() > 0) {
            result = new ArrayList<NameValuePair>();
            parse(result, new Scanner(content), encoding != null ? encoding.getValue() : null);
        }
    }
    return result;
}

From source file:org.springframework.social.facebook.api.impl.json.ReferenceListDeserializer.java

@SuppressWarnings("unchecked")
@Override//from  w  w  w . j a v a  2 s .co  m
public List<Reference> deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new FacebookModule());
    jp.setCodec(mapper);
    if (jp.hasCurrentToken()) {
        JsonNode dataNode = (JsonNode) jp.readValueAs(JsonNode.class).get("data");
        if (dataNode != null) {
            return (List<Reference>) mapper.reader(new TypeReference<List<Reference>>() {
            }).readValue(dataNode);
        }
    }

    return Collections.emptyList();
}

From source file:com.android.idtt.http.client.util.URLEncodedUtils.java

/**
 * Returns a list of {@link org.apache.http.NameValuePair NameValuePairs} as built from the
 * URI's query portion. For example, a URI of
 * http://example.org/path/to/file?a=1&b=2&c=3 would return a list of three
 * NameValuePairs, one for a=1, one for b=2, and one for c=3.
 * <p/>/*  w w  w . jav  a2 s  .  c o  m*/
 * This is typically useful while parsing an HTTP PUT.
 *
 * @param uri      uri to parse
 * @param encoding encoding to use while parsing the query
 */
public static List<NameValuePair> parse(final URI uri, final String encoding) {
    final String query = uri.getRawQuery();
    if (!TextUtils.isEmpty(query)) {
        List<NameValuePair> result = new ArrayList<NameValuePair>();
        Scanner scanner = new Scanner(query);
        parse(result, scanner, encoding);
        return result;
    } else {
        return Collections.emptyList();
    }
}

From source file:com.acc.core.search.solrfacetsearch.provider.impl.ColorFacetValueProvider.java

@Override
public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig,
        final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException {
    final ApparelStyleVariantProductModel apparelStyleModel = getApparelStyleProductModel(model);
    if (apparelStyleModel == null) {
        return Collections.emptyList();
    }/* w  w  w  .  j  a v  a2 s . c  o  m*/

    final Set<SwatchColorEnum> colors = apparelStyleModel.getSwatchColors();

    if (colors != null && !colors.isEmpty()) {
        final Collection<FieldValue> fieldValues = new ArrayList<FieldValue>();
        for (final SwatchColorEnum color : colors) {
            fieldValues.addAll(createFieldValue(color, indexedProperty));
        }
        return fieldValues;
    } else {
        return Collections.emptyList();
    }
}

From source file:com.hybris.datahub.core.services.impl.DataHubImpExResourceFactoryUnitTest.java

private FragmentReader dummyFragmentReader() {
    final List<ImpExFragment> noFragments = Collections.emptyList();
    return simulateFragmentReader(noFragments);
}

From source file:com.acc.core.search.solrfacetsearch.provider.impl.GenderValueProvider.java

@Override
public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig,
        final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException {
    final ApparelProductModel apparelModel = getApparelProductModel(model);
    if (apparelModel == null) {
        return Collections.emptyList();
    }//  www.  j a  v a  2 s . c om

    final List<Gender> genders = apparelModel.getGenders();

    if (genders != null && !genders.isEmpty()) {
        final Collection<FieldValue> fieldValues = new ArrayList<FieldValue>();
        for (final Gender gender : genders) {
            fieldValues.addAll(createFieldValue(gender, indexedProperty));
        }
        return fieldValues;
    } else {
        return Collections.emptyList();
    }
}

From source file:de.mg.stock.server.update.StockUpdateFromYahooHistorical.java

@Override
public List<DayPrice> get(String symbol) {

    LocalDateTime fetchTime = dateTimeProvider.now();

    String response = httpUtil.get("https://ichart.yahoo.com/table.csv?s=" + symbol);
    if (isEmpty(response)) {
        logger.warning("nothing received for " + symbol);
        return Collections.emptyList();
    }//from  w  w w .  ja  v  a  2  s. c o  m

    String[] lines = response.split(System.getProperty("line.separator"));
    if (lines.length < 2) {
        logger.warning("no lines received for " + symbol);
        return Collections.emptyList();
    }
    if (!"Date,Open,High,Low,Close,Volume,Adj Close".equals(lines[0])) {
        logger.warning("wrong header for " + symbol + ": " + lines[0]);
        return Collections.emptyList();
    }

    List<DayPrice> result = new ArrayList<>();

    for (int i = 1; i < lines.length; i++) {
        StringTokenizer tok = new StringTokenizer(lines[i], ",");
        LocalDate date = toLocalDate(tok.nextToken(), "yyyy-MM-dd");
        DayPrice dayPrice = new DayPrice(date);

        // skip
        tok.nextToken();

        dayPrice.setMax(toLong(tok.nextToken()));
        dayPrice.setMin(toLong(tok.nextToken()));

        dayPrice.setFetchedAt(fetchTime);

        if (dayPrice.getMax() != null && dayPrice.getMin() != null && dayPrice.getMax() != 0
                && dayPrice.getMin() != 0)
            result.add(dayPrice);
    }

    return result;
}