I am trying to pass attributeNames
which is a collection of string
to a method setColumnNames
that accepts string 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;
}
Definition for setColumnNames
SliceQuery<K, N, V> setColumnNames(N... columnNames);
I am getting this exception everytime-
The method setColumnNames(String...) in the type SliceQuery<String,String,String> is not applicable for the arguments (Collection<String>)
How can I convert collection of strings to string array in Java? Any idea?