在这篇文章中,我们将为您详细介绍使用GoogleGuava过滤JavaBeans列表的内容,并且讨论关于java谷歌的相关问题。此外,我们还会涉及一些关于com.google.guava:guava组
在这篇文章中,我们将为您详细介绍使用Google Guava过滤JavaBeans列表的内容,并且讨论关于java 谷歌的相关问题。此外,我们还会涉及一些关于com.google.guava:guava 组件安全漏洞及健康分析、google guava 引入guava原因 一、Guava 17.0 发布,来自 Google 的 Java 类库、Guava 19.0 RC2 发布,Google 的常用 Java 类的知识,以帮助您更全面地了解这个主题。
本文目录一览:- 使用Google Guava过滤JavaBeans列表(java 谷歌)
- com.google.guava:guava 组件安全漏洞及健康分析
- google guava 引入guava原因 一
- Guava 17.0 发布,来自 Google 的 Java 类库
- Guava 19.0 RC2 发布,Google 的常用 Java 类
使用Google Guava过滤JavaBeans列表(java 谷歌)
在Java程序中,我有一个要基于特定属性过滤的bean列表。
例如,假设我有一个Person列表,一个JavaBean,其中Person具有许多属性,其中包括“名称”。
我也有一个名字列表。
现在,我想查找姓名在姓名列表中的所有人员。
使用Google Guava执行此过滤器的最佳方法是什么?
到目前为止,我已经考虑过将Guava与Apache beanutils结合使用,但这似乎并不优雅。
我还在这里找到了反射扩展库:http :
//code.google.com/p/guava-reflection/,但是我不确定如何使用它(几乎没有文档)。
有什么想法吗?
ps你能告诉我我真的很想念Python列表理解吗?
com.google.guava:guava 组件安全漏洞及健康分析
组件简介
维护者 | google 组织 | 许可证类型 | Apache-2.0 |
---|---|---|---|
首次发布 | 2010 年 4 月 26 日 | 最新发布时间 | 2023 年 8 月 1 日 |
GitHub Star | 48189 | GitHub Fork | 10716 |
依赖包 | 28,694 | 依赖存储库 | 219,576 |
Guava 是 Google 的一组核心 Java 库,其中包括新的集合类型(例如 multimap 和 multiset)、不可变集合、图形库以及用于并发、I/O、哈希、原语、字符串等的实用程序。
官网:https://guava.dev/
官方仓库:https://github.com/google/guava
参考链接:
https://packages.ecosyste.ms/registries/repo1.maven.org/packages/com.google.guava:guava
组件健康度
技术健康度 | 该组件是由谷歌开发的一套核心 Java 库,包含了多种新的集合类型(如 multimap 和 multiset)、不可变集合、图形库以及并发、I/O、哈希、基本类型、字符串等方面的实用工具。该组件的代码质量高,测试覆盖率高,性能优化良好,功能丰富而稳定。 |
---|---|
社区健康度 | 该组件在 GitHub 上有超过 4.8 万个星标,1 万多个分支,632 个未解决的问题和 93 个未合并的拉取请求。该组件有一个活跃的社区,用户可以在 StackOverflow 上提出问题,或者在 guava-announce 和 guava-discuss 两个邮件列表上获取最新的发布信息和讨论话题。 |
更新和维护频率 | 该组件的最新版本是 32.1.2,于 2023 年 8 月 1 日发布。该组件的发布周期大约为 3 个月左右,每次发布都会包含一些新特性、改进和修复。该组件的开发团队由谷歌内部的 Java 核心库团队负责,他们对该组件的更新和维护非常积极和专业。 |
兼容性 | 该组件提供了两种不同的 "风味":一种是用于 Java 8 或更高版本的 JRE 上,另一种是用于 Android 或任何想要与 Android 兼容的库上。这两种风味在 Maven 版本字段中分别指定为 32.1.2-jre 或 32.1.2-android。该组件只需要一个运行时依赖,即 failureaccess-1.0.1.jar。该组件遵循语义化版本控制原则,尽量保持向后兼容性,但也会在必要时对一些标记为 @Beta 注解的 API 进行变更。 |
文档和支持 | 该组件有一个完善的用户指南 Guava Explained,以及详细的 Javadoc 文档。该组件还提供了 JDiff 文档来展示不同版本之间的 API 差异。此外,该组件还有一个 GitHub 项目页面,用户可以在上面查看源代码、提交问题或拉取请求、参与讨论等。 |
综上所述,com.google.guava:guava 是一个健康度较高的组件,具有成熟的技术、活跃的社区、频繁的更新和维护、良好的兼容性和丰富的文档和支持。
参考链接:
https://github.com/google/guava
https://github.com/google/guava/releases
https://guava.dev/
组件许可证解读
Apache License 2.0 是一种开源软件许可证,广泛用于授权开源项目和代码。Apache License 2.0 允许用户自由地使用、修改和分发受许可的软件,而无需支付版权费用或专利费用。它鼓励开发者共享他们的代码,并保护用户的权利。以下是该许可证的一些重要特点:
- 代码使用权:用户可以自由地使用、复制、修改、合并、发布、分发和销售受许可软件。
- 版权声明:用户必须在所有源代码副本中保留原始的版权声明、许可证声明和免责声明。
- 修改代码:如果用户对代码进行了修改,需要清楚标明哪些部分发生了变化,并不能暗示原作者同意这些修改。
- 商标使用:Apache License 2.0 并未授予使用原软件的任何商标或名称的权利。
- 专利许可:该许可证授予了在使用、修改或分发受许可软件时相关专利的非独占许可。这意味着如果用户授权其他人使用该软件,相关专利许可也会传递给接收方。
- 再许可:用户可以将受 Apache License 2.0 许可的代码作为一部分整合到其它开源项目中,并使用不同的许可证授权整个项目。但是,需要在代码中显式地说明使用了 Apache License 2.0 许可的部分。
需要注意的是,Apache License 2.0 并不保证软件没有缺陷或不稳定性,使用该软件的风险由用户自行承担。
许可证原文链接:https://github.com/google/guava/blob/master/LICENSE
组件漏洞版本及修复方案
漏洞编号 | 漏洞标题 | 漏洞等级 | 影响版本 | 修复版本 |
---|---|---|---|---|
MPS-mfku-xzh3 | Guava<32.0.0 存在竞争条件漏洞 | 中危 | [1.0,32.0.0-jre) | 32.0.0-jre |
MPS-2020-17429 | Google Guava 访问控制错误漏洞 | 低危 | (-∞,30.0-jre) | 30.0-jre |
MPS-2018-5515 | Google Guava 不可信数据的反序列化漏洞 | 中危 | [24.1.1-android,24.1.1-jre) | 24.1.1-jre |
同类型可替代组件
- Caffeine:一个基于 Java 8 的高性能、近乎最优的缓存库,支持多种过期策略和异步加载。官网:https://github.com/ben-manes/caffeine
- Eclipse Collections:一个提供了丰富的集合类型和实用工具的 Java 库,包括列表、集合、映射、多映射、堆栈、袋子、双端队列等。官网:https://eclipse.dev/collections/ja/index.html
- Apache Commons Collections:一个扩展了 Java 集合框架的库,提供了一些新的集合类型,如双向映射、循环缓冲区、有序集合等,以及一些转换器、迭代器、比较器等实用工具。官网:https://commons.apache.org/proper/commons-collections/
- Javatuples:一个简单而强大的 Java 元组库,支持从一元组到十元组的不可变对象,以及一些操作元组的方法。官网:https://www.javatuples.org/
组件 SBOM
组件名称 | 版本 | 是否直接依赖 | 仓库 |
---|---|---|---|
com.google.guava:listenablefuture | 9999.0-empty-to-avoid-conflict-with-guava | 是 | maven |
com.google.guava:listenablefuture | 1.0 | 是 | maven |
com.google.errorprone:error_prone_annotations | 2.21.1 | 是 | maven |
com.google.guava:guava | HEAD-jre-SNAPSHOT | 是 | maven |
org.hamcrest:hamcrest-core | 1.3 | 否 | maven |
com.google.j2objc:j2objc-annotations | 2.8 | 是 | maven |
com.google.guava:guava | HEAD-android-SNAPSHOT | 是 | maven |
com.google.guava:failureaccess | 1.0.1 | 是 | maven |
junit:junit | 4.13.2 | 是 | maven |
该 SBOM 清单仅展示部分内容
完整 SBOM 清单及检测报告:
https://www.murphysec.com/console/report/1696087042139447296/1696087065539469312?allow=1
关于墨知
墨知是国内首个专注软件供应链安全领域的技术社区,社区致力于为国内数百万技术人员提供全方位的软件供应链安全专业知识内容,包括软件供应链安全技术、漏洞情报、开源组件安全、SBOM、软件成分分析(SCA)、开源许可证合规等前沿技术及最佳实践。
墨知主要内容分类:
- 漏洞分析:漏洞_墨知 (oscs1024.com)
- 投毒分析:投毒分析_墨知 (oscs1024.com)
- 行业动态:行业动态_墨知 (oscs1024.com)
- 行业研究:行业研究_墨知 (oscs1024.com)
- 工具推荐:工具推荐_墨知 (oscs1024.com)
- 最佳实践:最佳实践_墨知 (oscs1024.com)
- 技术科普:技术科普_墨知 (oscs1024.com)
墨知通过促进知识共享、技术研究和合作交流,帮助组织和个人提高软件供应链的安全性,减少供应链攻击的风险,并保护软件生态系统的整体安全。
进入社区:墨知 - 软件供应链安全技术社区
原文来自:com.google.guava:guava 组件安全漏洞及健康分析_墨知 (oscs1024.com)
google guava 引入guava原因 一
guava包含了java项目依赖的几个google核心库,集合,缓存,原始的支持,并发库,基本的注解,字符串处理,i/o等等
基本的特点
- 避免了null
- 前置检查 testpreconditions
- 基本对象方法 hashcoe()
- 排序 强大的fluent comparator 类
- 异常处理 简化增强和检查异常和错误
集合
扩展集合 扩展了jdk的集合生态,有一些成熟的流行的使用方法;
不可变的集合 防御性的变成,常量集合,改善的性能;
新的集合类型 multisets multimaps tables bidrectional maps 等;
强大的集合工具 java.util.collections中没有提供的一般操作;
扩展的工具 写一个集合的装饰器,我们这里更简单
图表
为图类型的数据创建的结构,实体和之间的联系 graph valuegraph network
缓存cache
本地缓存,支持大范围的有效操作
功能性语法:能够简化操作
并发:
强大的简单的抽象,能够简单的写出正确的代码
listenablefutre:futures ,完成之后的回调
订阅 :能够开启和关闭,关注不同的状态
字符串:一些有用的方法 拆分合并,添加等
原生方法 :原生类型如int char 上面的操作,而jdk却没有支持
范围操作: 强大的方法处理实现了比较接口的类型,不管是连续的还是间断的
i/o操作:简化io操作特别是jdk5,6中在文件和流上的操作
hashing: 更多的hash方法,包含bloom过滤
eventbus:发布订阅:在组件之间通信,相互之间不需要明确的注册关系
math:数学相关的,是jdk没有提供的相关方法
反射: guava对java中的反射进行了进一步的优化
Guava 17.0 发布,来自 Google 的 Java 类库
Guava 17.0 发布了,改进内容包括:
解决若干bug(8 issues)
API接口的调整
common.base
Verify and VerifyException
Converter.from(Function<A, B>, Function<B, A>)
common.cache
CacheLoader.asyncReloading(CacheLoader<K, V>, Executor)
common.io
ByteStreams.newDataInput(ByteArrayInputStream)
ByteStreams.newDataOutput(ByteArrayOutputStream)
Closeables.closeQuietly(InputStream)
Closeables.closeQuietly(Reader)
common.net
HostAndPort.fromHost(String)
common.util.concurrent
Futures.inCompletionOrder(Iterable<ListenableFuture<T>>)
MoreExecutors.shutdownAndAwaitTermination(ExecutorService, long, TimeUnit)
Service (and subclasses) - deprecated methods removed.
优化布隆过滤器的性能(1119),注意如果你使用了BloomFilters,并且采用了序列化传递给另外的服务器和进程,那么你可能会遇到反序列化的问题。
Guava 19.0 RC2 发布,Google 的常用 Java 类
Guava 19.0 RC2 发布,此版本值得关注的 API 改进如下:
common.base
Added
CharMatcher
static factory methods equivalent to theCharMatcher
constants. For example, addedCharMatcher.whitespace()
which is equivalent toCharMatcher.WHITESPACE
. Eventually, the constants will be deprecated and removed.This is being done because using constants requires a large number of classes to be initialized when anything from
CharMatcher
is used; switching to static factory methods allows classes to be initialized only as needed for the type ofCharMatcher
actually being used.Added
Throwables.lazyStackTrace(Throwable)
- Returns aList<StackTraceElement>
that may load the stack trace elements lazily. Useful if you want to get only the first N elements of the stack trace efficiently.Added
lazyStackTraceIsLazy()
- Returns whether or not the above method is able to use the special implementation that makes it lazy on the current platform.Added
VerifyException
constructor overloads taking aThrowable
cause.
common.cache
This package has graduated from @Beta
, making it safe to use in library code.
Added visibility of
CacheLoader.UnsupportedLoadingOperationException
Added
RemovalNotification.create
These should only be needed if creating a custom cache implementation
common.collect
Added factory and builder methods for various ImmutableMap
s and ImmutableMultimap
s that take Iterable<Map.Entry>
.
Added
FluentIterable.toMultiset()
Added
RangeSet.asDescendingSetOfRanges()
andRangeMap.asDescendingMapOfRanges()
Added
Lists.cartesianProduct(List...)
andLists.cartesianProduct(List<List>>)
Added
Maps.newLinkedHashMapWithExpectedSize(int)
Re-added
Multisets.removeOccurrences(Multiset, Multiset)
which was (binary incompatibly) missing in 18.0 because it was replaced withMultisets.removeOccurences(Multiset, Iterable)
Deprecated
MapConstraint
andMapConstraints
Deprecated
Sets.newSetFromMap(Map)
- Java 6 providesCollections.newSetFromMap(Map)
Removed
MapMaker.softValues()
common.eventbus
Added
EventBus.identifier()
Removed protected method
AsyncEventBus.dispatchQueuedEvents()
(made package-private)
common.hash
Added
BloomFilter.create
overloads taking along
for theexpectedInsertions
Added
Hashing.sha384()
Added
Hashing.concatenating(HashFunction, HashFunction, HashFunction...)
andHashing.concatenating(Iterable<HashFunction>)
common.io
Added
ByteSource.sizeIfKnown()
Added
CharSource.length()
Added
CharSource.lengthIfKnown()
common.net
Added a couple new constants to
HttpHeaders
andMediaType
Updated public suffix list for
InternetDomainName
common.reflect
Added
TypeToken.isSubtypeOf(TypeToken)
,TypeToken.isSupertypeOf(TypeToken)
and overloads of both that take aType
Deprecated
TypeToken.isAssignableFrom(TypeToken)
andTypeToken.isAssignableFrom(Type)
-isSupertypeOf
provides equivalent behavior with a less confusing name
common.util.concurrent
Futures.getChecked
, the replacement forFutures.get
(see below), has become stricter. It now rejects calls that pass an unsuitable exception type, even if the inputFuture
succeeded. Previously, it would reject only calls in which the inputFuture
had failed.Added
AbstractFuture.newCancellationCause()
Added
AbstractFuture.setFuture(ListenableFuture)
Added
Futures.getChecked
Added
Futures.catching
andFutures.catchingAsync
Added
Futures.transformAsync
Added
Futures.withTimeout
Deprecated
FutureFallback
andFutures.withFallback
methods - these are replaced withFutures.catching
Deprecated
Futures.get
methods taking aClass<X extends Exception>
- these are replaced withFutures.getChecked
Deprecated
Futures.transform
methods taking anAsyncFunction
- these are replaced withFutures.transformAsync
更多改进请看发行说明。
下载链接:https://github.com/google/guava/archive/v19.0-rc2.zip。
Guava | Guava (GWT) | |
---|---|---|
Maven Identifier | com.google.guava:guava:19.0-rc2 | com.google.guava:guava-gwt:19.0-rc2 |
Jar | guava-19.0-rc2.jar | guava-gwt-19.0-rc2.jar |
Javadoc | guava-19.0-rc2-javadoc.jar | guava-gwt-19.0-rc2-javadoc.jar |
Sources | guava-19.0-rc2-sources.jar | guava-gwt-19.0-rc2-sources.jar |
Guava 中文是石榴的意思,该项目是 Google 的一个开源项目,包含许多 Google 核心的 Java 常用库。
目前主要包含:
com.google.common.annotations
com.google.common.base
com.google.common.collect
com.google.common.io
com.google.common.net
com.google.common.primitives
com.google.common.util.concurrent
在线API doc:http://tool.oschina.net/apidocs/apidoc?api=guava
今天的关于使用Google Guava过滤JavaBeans列表和java 谷歌的分享已经结束,谢谢您的关注,如果想了解更多关于com.google.guava:guava 组件安全漏洞及健康分析、google guava 引入guava原因 一、Guava 17.0 发布,来自 Google 的 Java 类库、Guava 19.0 RC2 发布,Google 的常用 Java 类的相关知识,请在本站进行查询。
本文标签: