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.linecorp.bot.model.response.BotApiResponse.java

public BotApiResponse(@JsonProperty("message") String message, @JsonProperty("details") List<String> details) {
    this.message = message;
    this.details = details == null ? Collections.emptyList() : details;
}

From source file:com.ok2c.lightmtp.SMTPCommand.java

public SMTPCommand(final String code, final String argument, final List<String> params) {
    super();//  w w w .  j av a  2s.co m
    Args.notNull(code, "Code");
    this.verb = code;
    this.argument = argument;
    if (params == null || params.isEmpty()) {
        this.params = Collections.emptyList();
    } else {
        this.params = Collections.unmodifiableList(new ArrayList<String>(params));
    }
}

From source file:com.asakusafw.runtime.stage.launcher.Util.java

private static List<File> list(File file) {
    return Optional.ofNullable(file.listFiles()).map(Arrays::asList).orElse(Collections.emptyList());
}

From source file:com.siemens.sw360.datahandler.common.ImportCSV.java

/**
 * reads a CSV file and returns its content as a list of CSVRecord
 *
 * @param in/*from   ww  w  .  j a v a 2 s. c o m*/
 * @return list of records
 */
public static List<CSVRecord> readAsCSVRecords(InputStream in) {
    List<CSVRecord> records = null;

    try (Reader reader = new InputStreamReader(in)) {
        CSVParser parser = new CSVParser(reader, CommonUtils.sw360CsvFormat);
        records = parser.getRecords();
        records.remove(0); // Remove header
    } catch (IOException e) {
        log.error("Error parsing CSV File!", e);
    }

    // To avoid returning null above
    if (records == null)
        records = Collections.emptyList();

    return records;
}

From source file:io.sqp.core.messages.TypeMappingMessage.java

public TypeMappingMessage() {
    _keywords = Collections.emptyList();
}

From source file:com.opengamma.web.analytics.blotter.BeanTraverser.java

BeanTraverser() {
    _decorators = Collections.emptyList();
}

From source file:controllers.api.v2.Dataset.java

public static Promise<Result> listSegments(@Nullable String platform, @Nonnull String prefix) {
    try {/*w  w w  .j a v  a  2  s  . co  m*/
        if (StringUtils.isBlank(platform)) {
            return Promise.promise(() -> ok(Json.toJson(DATA_TYPES_DAO.getAllPlatforms().stream()
                    .map(s -> s.get("name")).collect(Collectors.toList()))));
        }

        List<String> names = DATASET_VIEW_DAO.listSegments(platform, "PROD",
                getPlatformPrefix(platform, prefix));

        // if prefix is a dataset name, then return empty list
        if (names.size() == 1 && names.get(0).equalsIgnoreCase(prefix)) {
            return Promise.promise(() -> ok(Json.toJson(Collections.emptyList())));
        }

        return Promise.promise(() -> ok(Json.toJson(names)));
    } catch (Exception e) {
        Logger.error("Fail to list dataset names/sections", e);
        return Promise.promise(() -> internalServerError("Fetch data Error: " + e.toString()));
    }
}

From source file:ch.ivyteam.ivy.maven.util.FileSetConverter.java

public List<org.codehaus.plexus.archiver.FileSet> toPlexusFileSets(
        org.apache.maven.model.FileSet[] mavenFileSets) {
    if (mavenFileSets == null) {
        return Collections.emptyList();
    }//from   w  w  w  .ja v  a  2 s . co m

    List<org.codehaus.plexus.archiver.FileSet> plexusFileSets = new ArrayList<>();
    for (org.apache.maven.model.FileSet fs : mavenFileSets) {
        plexusFileSets.add(toPlexusFileset(fs));
    }
    return plexusFileSets;
}

From source file:org.jug.bg.rest.hateoas.spring.alternative.repository.AlternativeRepository.java

/**
 * Retrieves all alternatives for a poll id.
 *
 * @param alternativeParameter Alternative parameter used for alternatives retrieval.
 *
 * @return Returns all alternatives for a poll id if exist or an empty list otherwise.
 *///www.j  a  va 2s  .  c  o  m
public List<Alternative> retrieveAllAlternatives(AlternativeParameter alternativeParameter) {
    Long pollId = alternativeParameter.getPollId();
    if (!store.containsKey(pollId)) {
        return Collections.emptyList();
    }
    return new ArrayList<>(store.get(pollId).values());
}

From source file:ca.liquidlabs.android.speedtestvisualizer.util.CsvDataParser.java

/**
 * Parses CSV data/*from  ww  w . j a v  a  2s.  c om*/
 * 
 * @param csvHeader Header items for csv records
 * @param csvData
 * @return
 */
public static List<SpeedTestRecord> parseCsvData(String csvHeader, String csvData) {
    Reader in = new StringReader(getCsvData(csvHeader, csvData));
    try {
        CSVParser parser = new CSVParser(in, CSVFormat.DEFAULT.toBuilder().withHeader().build());

        // get the parsed records
        List<CSVRecord> list = parser.getRecords();
        // create a list to convert data into SpeedTestRecord model
        List<SpeedTestRecord> speedTestRecords = new ArrayList<SpeedTestRecord>();
        for (CSVRecord csvRecord : list) {
            speedTestRecords.add(new SpeedTestRecord(csvRecord));
        }

        return speedTestRecords;
    } catch (IOException e) {
        Tracer.error(LOG_TAG, e);
    }
    // when no data, send empty list
    return Collections.emptyList();
}