8

を受け入れるメソッドattributeNamesにを渡そうとしています。collection of stringsetColumnNamesstring array

public Map<String, String> getAttributes(String rowKey, Collection<String> attributeNames, String columnFamily) {

    try {

        SliceQuery<String, String, String> query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), StringSerializer.get(), StringSerializer.get()).
                setKey(rowKey).setColumnFamily(columnFamily).setColumnNames(attributeNames);

    } catch (HectorException e) {
        LOG.error("Exception in CassandraHectorClient::getAttributes " +e+ ", RowKey = " +rowKey+ ", Attribute Names = " +attributeNames);
    }

    return null;
   }

の定義setColumnNames

SliceQuery<K, N, V> setColumnNames(N... columnNames);

毎回この例外が発生します-

The method setColumnNames(String...) in the type SliceQuery<String,String,String> is not applicable for the arguments (Collection<String>)

Javaで文字列のコレクションを文字列配列に変換するにはどうすればよいですか? 何か案が?

4

1 に答える 1