Guava bimap

Posted 学习、实践、总结

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Guava bimap相关的知识,希望对你有一定的参考价值。

A bimap (or "bidirectional map") is a map that preserves the uniqueness of
its values as well as that of its keys. This constraint enables bimaps to
support an "inverse view", which is another bimap containing the same entries
as this bimap but with reversed keys and values.

从注释来看,一个biMap是一个值有唯一性的Map。可以通过inverse()方法进行key与value的反转。

如果put操作时,插入不同key的相同value值,那么会抛出“Exception in thread "main" java.lang.IllegalArgumentException: value already present:”异常

以上是关于Guava bimap的主要内容,如果未能解决你的问题,请参考以下文章

Guava学习笔记概览

Guava文档翻译之 Guava简介

Guava的使用

guava怎么读

Java技术专题「Guava技术系列」Guava-Collections实战使用相关Guava不一般的集合框架

无法使用 guava-datatype 从 Spring 服务中使用 GWTP-Rest + jackson-guava 反序列化 guava 类型