Set keys=Map.keyset()

目前只有MapProperties要用到keyset()方法

Properties:指JDBC时候的连接数据库,把数据库的参数提取到配置文件时用到,

通俗的讲,Properties专门用来读取配置文件的,它也是一一对应的

有一个Map对象,这时候使用keySet()方法获取所有的key值

参考:https://blog.csdn.net/god123209/article/details/6712094

Set keys=Map.keyset()怎么理解?

参考:https://zhidao.baidu.com/question/936104974287696212.html

keySet() 方法是用来获取包含在这个哈希表的键的Set视图

private Map<String,Object> scores;
private Properties properties;

Set<String> keys=demo01.getScores().keySet();

Set<Object> keys=demo01.getProperties().keySet();

参考:https://www.yiibai.com/java/util/hashtable_keyset.html

猜你喜欢

转载自www.cnblogs.com/yingyigongzi/p/9258693.html