Reputation: 29507
Is there any way to get a list of properties name from Properties and convert it into a String[]?
Properties
String[]
Upvotes: 2
Views: 2136
Reputation: 1109362
Properties implements Map which has a keySet() method which returns a Set with all keys. The Set in turn has a toArray() method which allows you to get the values as a plain array.
Map
keySet()
Set
toArray()
So, this should do:
String[] keys = properties.keySet().toArray(new String[0]);
Upvotes: 8