gpt4 book ai didi

java - 如何迭代 LoadingCache 谷歌类

转载 作者:行者123 更新时间:2023-11-30 03:17:57 26 4
gpt4 key购买 nike

我有一个像这样的loadingcache类:

LoadingCache<Integer, List<Parent>> parents

其中 Parent 是一个具有 iddescriptionhomenickname< 的类

我想打印 parents 对象内的所有值

我尝试做类似的事情:

parents.keys()

但我找不到 LoodingCache 对象的方法

最佳答案

您可以使用方法 asMap() 代替:

  /**
* Returns a view of the entries stored in this cache as a thread-safe map. Modifications made to
* the map directly affect the cache.
*/
ConcurrentMap<K, V> asMap();

关于java - 如何迭代 LoadingCache 谷歌类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32095398/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com