java object数组转成string数组

  private String[] getIndexNamesByTime(TraceLogRequestDto t, String indexName) {
        String startTime = t.getStartTime();
        String endTime = t.getEndTime();
        List days = DateUtils.getDays(startTime, endTime);
        //得到 索引类型为 log-trace-2019-01-02
        List indexNames = days.stream().map(m ->  indexName+"-"+ m ).collect(Collectors.toList());
        //默认包含indexName
        indexNames.add(indexName);
        String[] res = (String[]) indexNames.toArray(new String[indexNames.size()]);
        return res;
    }

 

你可能感兴趣的:(j2se)