Properties
Properties in the collections framework are used to maintain lists of key-value pairs where both are of the String
class. Properties are relevant when obtaining environmental values from the operating system, for example, and are the grounding class for many other classes. One of the main characteristics of the Properties
class is that it allows the definition of a default response in the case of a search for a certain key not being satisfactory. The following example highlights the basics of this case:
Example20.java
1Â Â import java.util.*; 2Â Â 3Â Â public class Example20 { 4Â Â 5Â Â Â Â Â public static void main(String[] args) { 6Â Â Â Â Â Â Â Â Â Properties properties = new Properties(); 7Â Â Â Â Â Â Â Â Â Set setOfKeys; 8Â Â Â Â Â Â Â Â Â String key; 9Â Â 10Â Â Â Â Â Â ...