Skip to Main Content

Application Development Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why does entrySet() method on a java.util.Properties object not return a set of Entry<String, String> objects?

Hubert KaukerAug 31 2024

The java.util.Properties class has a String getProperty (String key) method. So we learn that all keys as well as all values are of String type.

This is confirmed by the presence of method Set<String> stringPropertyNames(), which returns the set of all keys.

QUESTION 1:

Why does the Enumeration<?> propertyNames() not return an Enumeration<String> ?

QUESTION 2:

When we use the entrySet() method, we get a return value of a set of Entry<Object, Object> . Why is the method not overridden so that we get a set of Entry<String, String> ?

QUESTION 3:

If this would be fixed in a next release, would it break existing software?

Thanks. Hubert

Comments
Post Details
Added on Aug 31 2024
0 comments
28 views