Java 集合框架 (The Collections Framework) 之 UML 类图

一、Java 集合框架简介

  • Java 集合框架是一个统一的体系结构,用于表示和操作集合,使它们能够独立于表示的细节进行操作。它减少了编程工作量,且提高了性能。它支持不相关api之间的互操作性,减少设计和学习新api的工作量,且促进了软件重用。该框架基于十几个集合接口,且包括这些接口的实现以及操作它们的算法。

The collections framework is a unified architecture for representing and manipulating collections, enabling them to be manipulated independently of the details of their representation. It reduces programming effort while increasing performance. It enables interoperability among unrelated APIs, reduces effort in designing and learning new APIs, and fosters software reuse. The framework is based on more than a dozen collection interfaces. It includes implementations of these interfaces and algorithms to manipulate them.

二、Java 常见集合 UML 类图

  • Java 集合框架经常使用的类的类间关系如下 UML 类图所示(实现的一些标识接口未展示在图中,如 Serializable 序列化接口、Cloneable 克隆接口、RandomAccess 随机访问接口):

在这里插入图片描述
在这里插入图片描述

  • 除上述集合框架类外还包含 Collections 与 Arrays 类,它们包含的都是静态方法。
  • 根据 Java 集合框架的 UML 类图可得:
    • Java 集合框架主要包括两种,一种是集合(Collection:存储一个元素集合),另一种是映射(Map:存储键/值对映射)
    • Collection 接口 (存储一组不唯一,无序的对象) 的三个直接子接口分别为:
      • List (存储一组不唯一,有序的对象)
      • Set (存储一组唯一,无序的对象)
      • Queue (A collection designed for holding elements before processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations.)
  • Attention:TreeSet 实现的直接父接口是 NavigableSet,而 NavigableSet 继承了 SortedSet 接口

参考:
Java API 官方文档:https://docs.oracle.com/javase/8/docs/api/

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值