java集合vs集合框架中的映射 [英] java collections vs map in collections framework

查看:137
本文介绍了java集合vs集合框架中的映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 http://docs.oracle.com/javase/tutorial/collections/interfaces /index.html 有两个顶级接口,称为集合和映射。

According to http://docs.oracle.com/javase/tutorial/collections/interfaces/index.html there are two top level interfaces called collection and map.

分隔这两个的确切原因是什么?

Whats the exact reason for separating these two ?

这是所有键值数据结构实现地图接口和所有其他实现集合接口?

Is it that all key value data structures implement the map interface and all others implement the collections interface ?

推荐答案

是的,是的!检查所有列表类,然后检查所有 Map 相关类。

Yes, That's correct! Check all the List classes and then check all the Map related classes.

并有这个真棒讨论,ob这个问题

and there is this awesome discussion, ob this question

列表与Java中的地图

视觉

这是一个集合,你知道这些书在那里,它的顺序像0,1,2,3 ...

This is a collection, by this you know that the books are there and it's in order like 0,1,2,3...

>

但是在地图中,图书在内存中无序,但为了计算机的方便,它有一个键来查找图书,如在图书馆。

But in a Map, the books are in memory unordered but for the computer's convenience it has a key to find the books, like in a library.

这篇关于java集合vs集合框架中的映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆