Provider get() method in Java with Examples
The get() method of java.security.Provider class is used to return the value to which the specified key is mapped, or null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key k to a value v such that (key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)
public Object get(Object key)
Parameters: This method takes the key as a parameter whose associated value is to be returned.
Return Value: This method returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
Below are the examples to illustrate the get() method:
value is : SHA1withDSA value is : SHA1withDSA value is : SHA1withDSA value is : Software value is : sun.security.provider.JavaKeyStore$DualFormatJKS value is : SHA value is : sun.security.provider.SHA value is : sun.security.provider.JavaKeyStore$CaseExactJKS value is : Software value is : sun.security.provider.DSA$SHA256withDSA
Trying to get the value of an unmapped key value is : null
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.