当前位置: 首页 > news >正文

青海网站开发 建设/成都网站seo厂家

青海网站开发 建设,成都网站seo厂家,免费网站加速器,台州网站开发公司一 容器介绍 容器,是用来容纳物体、管理物体。生活中,我们会用到各种各样的容器。如锅碗瓢盆、箱子和包等 程序中的“容器”也有类似的功能,用来容纳和管理数据。比如,如下新闻网站的新闻列表、教育网站的课程列表就是用“容器”来管理 视频…

一 容器介绍

  • 容器,是用来容纳物体、管理物体。生活中,我们会用到各种各样的容器。如锅碗瓢盆、箱子和包等

  • 程序中的“容器”也有类似的功能,用来容纳和管理数据。比如,如下新闻网站的新闻列表、教育网站的课程列表就是用“容器”来管理

  • 视频课程信息也是使用“容器”来管理

  • 计算机当中能够存储数据的位置有两个——>一个是磁盘,一个是内存

    • 磁盘是通过文件的形式存储数据的——>(永久存储,不会受到计算机的关闭而影响数据的)
    • 内存是临时存储——>关闭计算机后内存中是没有数据的
    • 容器存储的数据在内存当中

开发和学习中需要时刻和数据打交道,如何组织这些数据是我们编程中重要的内容。 我们一般通过“容器”来容纳和管理数据。事实上,我们前面所学的数组就是一种容器,可以在其中放置对象或基本类型数据。

数组的优势:是一种简单的线性序列,可以快速地访问数组元素,效率高。如果从查询效率和类型检查的角度讲,数组是最好的。

数组的劣势:不灵活。容量需要事先定义好,不能随着需求的变化而扩容。比如:我们在一个用户管理系统中,要把今天注册的所有用户取出来,那么这样的用户有多少个?我们在写程序时是无法确定的。因此,在这里就不能使用数组。

基于数组并不能满足我们对于“管理和组织数据的需求”,所以我们需要一种更强大、更灵活、容量随时可扩的容器来装载我们的对象。 这就是我们今天要学习的容器,也叫集合(Collection)。






二 容器结构

(三大接口)



1 结构图
在这里插入图片描述

List和Set都是单例接口,Map是双例接口(k,v)



2 单例集合
在这里插入图片描述

List——>相当于动态数组,Set——>相当于数学里的集合



3 双例集合
在这里插入图片描述

Map——>相当于数学里的函数,(mapping——>映射)





(单例集合)

三 (*)Collection接口

(12个方法)

(定义了单例集合的基本行为)

(接口中的方法很重要,注意返回值,和返回值类型)

Collection 表示一组对象,它是集中、收集的意思。Collection接口的两个子接口是List、Set接口。
在这里插入图片描述
在这里插入图片描述

Collection接口中定义的方法

方法说明
boolean add(Object element)增加元素到容器中
boolean remove(Object element)从容器中移除元素
boolean contains(Object element)容器中是否包含该元素
int size()容器中元素的数量
boolean isEmpty()容器是否为空
void clear()清空容器中所有元素
Iterator iterator()获得迭代器,用于遍历所有元素
boolean containsAll(Collection c)本容器是否包含c容器中的所有元素
boolean addAll(Collection c)将容器c中所有元素增加到本容器
boolean removeAll(Collection c)移除本容器和容器c中都包含的元素
boolean retainAll(Collection c)取本容器和容器c中都包含的元素,移除非交集元素
Object[] toArray()转化成Object数组

由于List、Set是Collection的子接口,意味着所有List、Set的实现类都有上面的方法。

JDK8之后,Collection接口新增的方法(将在JDK新特性和函数式编程中介绍):

新增方法说明
removeIf作用是删除容器中所有满足filter指定条件的元素
stream parallelStreamstream和parallelStream 分别返回该容器的Stream视图表示,不同之处在于parallelStream()返回并行的Stream,Stream是Java函数式编程的核心类。
spliterator可分割的迭代器,不同以往的iterator需要顺序迭代,Spliterator可以分割为若干个小的迭代器进行并行操作,可以实现多线程操作提高效率






四 (*)List接口

(6个方法)

(进一步细化了单例集合的存储特征)

(有序,可重复)




List接口特点

List是有序、可重复的容器。

有序:有序(元素存入集合的顺序和取出的顺序一致)。List中每个元素都有索引标记。可以根据元素的索引标记(在List中的位置)访问元素,从而精确控制这些元素

可重复:List允许加入重复的元素。更确切地讲,List通常允许满足 e1.equals(e2) 的元素重复加入容器。



List接口中的常用方法

除了Collection接口中的方法,List多了一些跟顺序(索引)有关的方法,参见下表:

方法说明
void add (int index, Object element)在指定位置插入元素,以前元素全部后移一位
Object set (int index,Object element)修改指定位置的元素
Object get (int index)返回指定位置的元素
Object remove (int index)删除指定位置的元素,后面元素全部前移一位
int indexOf (Object o)返回第一个匹配元素的索引,如果没有该元素,返回-1.
int lastIndexOf (Object o)返回最后一个匹配元素的索引,如果没有该元素,返回-1









五(ArrayList)

1 ArrayList容器的基本操作

(Collection里面的方法——>添加,删除,转数组,长度,判空,清除)

(是List接口的实现类。是List存储特征的具体实现)

(底层是用数组实现的——>查询效率高,增删效率低,线程不安全)

(数组是有索引的查询快,但是插入和删除都要移动后面所有的数据慢)

(建议如果没有用到Arraylist里面的方法,最好用List接口类型定义引用)








实例化
在这里插入图片描述

三种定义方式都可以

  • 但是ArrayList继承了List接口和Collection接口,可以用包括自己的所有的方法(缺点就是以后换容器时候代码会作废)
  • 用List虽然方法少,但是以后换容器的时候不用担心
  • 用Collection定义方法太少,一般不会用

建议如果没有用到Arraylist里面的方法,最好用List接口类型定义引用

示例

public class ArrayListTest {public static void main(String[] args) {//实例化ArrayList容器List<String> list = new ArrayList<>();//添加元素boolean flag1 = list.add("xiaojia");boolean flag2 = list.add("xiaoliu");boolean flag3 = list.add("jia");boolean flag4 = list.add("jia");System.out.println(flag1+"\t"+flag2+"\t"+flag3+"\t"+flag4);//将ArrayList转换为数组——>Collextion里面的方法,和数组里面的方法Object[] objects = list.toArray();System.out.println(Arrays.toString(objects));//删除元素——>可以选择删除数据,或者位置boolean flag4 = list.remove("oldlu");System.out.println(flag4);//获取容器中元素的个数int size = list.size();System.out.println(size);//判断容器是否为空boolean empty = list.isEmpty();System.out.println(empty);//容器中是否包含指定的元素boolean value = list.contains("itbz");System.out.println(value);//清空容器list.clear();Object[] objects1 = list.toArray();System.out.println(Arrays.toString(objects1));}
}




2 ArrayList容器的索引操作

(6个操作)

(指定位置添加元素,获取元素,元素替换,删除指定位置,查找元素在容器(第一次)(最后一次)出现位置)

public class ArrayListTest2 {public static void main(String[] args) {//实例化容器List<String> list = new ArrayList<>();//添加元素list.add("jia");list.add("jiajia");//向指定位置添加元素list.add(0,"xiao");System.out.println("获取元素");String value1 = list.get(0);System.out.println(value1);System.out.println("获取所有元素方式一");//使用普通for循环for(int i=0;i<list.size();i++){System.out.println(list.get(i));}System.out.println("获取所有元素方式二");//使用Foreach循环for(String str:list){System.out.println(str);}System.out.println("元素替换");list.set(1,"kevin");for(String str:list){System.out.println(str);}System.out.println("根据索引位置删除元素);String value2 = list.remove(1);System.out.println(value2);System.out.println("----------------");for(String str:list){System.out.println(str);}System.out.println("查找元素第一次出现的位置");int value3 = list.indexOf("jjj");System.out.println(value3);System.out.println("查找元素最后一次出现的位置");list.add("jjj");for(String str:list){System.out.println(str);}int value4 = list.lastIndexOf("jjj");System.out.println(value4);}
}




3 ArrayList并集、交集、差集

(Collection里面的3个方法)

(addAll,retainAll,removeAll)

并集

 //并集操作:将另一个容器中的元素添加到当前容器中List<String> a = new ArrayList<>();a.add("a");a.add("b");a.add("c");List<String> b = new ArrayList<>();b.add("a");b.add("b");b.add("c");//a并集ba.addAll(b);for(String str :a){System.out.println(str);}

交集

 //交集操作:保留相同的,删除不同的List<String> a1 = new ArrayList<>();a1.add("a");a1.add("b");a1.add("c");List<String> b1 = new ArrayList<>();b1.add("a");b1.add("d");b1.add("e");//交集操作a1.retainAll(b1);for(String str :a1){System.out.println(str);}

差集

//差集操作:保留不同的,删除相同的List<String> a2 = new ArrayList<>();a2.add("a");a2.add("b");a2.add("c");List<String> b2= new ArrayList<>();b2.add("b");b2.add("c");b2.add("d");a2.removeAll(b2);for(String str :a2){System.out.println(str);}





4 ArrayList源码分析

数组的初始化和扩容——>最开始数组长度为10,然后以1.5倍扩容,jdk1.8之后在操作数组时才初始化,节省内存

1
在这里插入图片描述

2
在这里插入图片描述

3
在这里插入图片描述

4
在这里插入图片描述







六 (Vector)

1 Vector容器的使用

(方法都加了同步检查——>“线程安全,效率低”)

(方法就增加了synchronized同步标记——>为了多线程的时候线程安全)

(单线程——>串型,多线程——>并型)

(使用容器的时候如果对线程安全有要求,大部分都使用ArrayList)





Vector(向量)的使用

Vector的使用与ArrayList是相同的,因为他们都实现了List接口,对List接口中的抽象方法做了具体实现。

public class VectorTest {public static void main(String[] args) {//实例化VectorList<String> v = new Vector<>();v.add("a");v.add("b");v.add("a");for(int i=0;i<v.size();i++){System.out.println(v.get(i));}System.out.println("----------------------");for(String str:v){System.out.println(str);}}
}




2 Vector源码分析

(和ArrayList底层都是数组,区别就是线程安全和效率)

(数组初始化方式,ArrayList1.8之后是延迟初始化(调用时初始化),在Vector中是立即初始化,长度也是10)

(ArrayList数组扩容1.5倍,Vector2倍扩容)

成员变量

/*** The array buffer into which the components of the vector are* stored. The capacity of the vector is the length of this array buffer,* and is at least large enough to contain all the vector's elements.** <p>Any array elements following the last element in the Vector are null.** @serial*/
protected Object[] elementData;/*** The number of valid components in this {@code Vector} object.* Components {@code elementData[0]} through* {@code elementData[elementCount-1]} are the actual items.** @serial*/protected int elementCount;/*** The amount by which the capacity of the vector is automatically* incremented when its size becomes greater than its capacity.  If* the capacity increment is less than or equal to zero, the capacity* of the vector is doubled each time it needs to grow.** @serial*/protected int capacityIncrement;

构造方法

public Vector() {this(10);
}

添加元素

/*** Appends the specified element to the end of this Vector.** @param e element to be appended to this Vector* @return {@code true} (as specified by {@link Collection#add})* @since 1.2*/
public synchronized boolean add(E e) {modCount++;ensureCapacityHelper(elementCount + 1);elementData[elementCount++] = e;return true;
}

数组扩容

/*** This implements the unsynchronized semantics of ensureCapacity.* Synchronized methods in this class can internally call this* method for ensuring capacity without incurring the cost of an* extra synchronization.** @see #ensureCapacity(int)*/
private void ensureCapacityHelper(int minCapacity) {// overflow-conscious code
//判断是否需要扩容,数组中的元素个数-数组长度,如果大于0表明需要扩容if (minCapacity - elementData.length > 0)grow(minCapacity);
}
private void grow(int minCapacity) {// overflow-conscious codeint oldCapacity = elementData.length;
//扩容2倍int newCapacity = oldCapacity + ((capacityIncrement > 0) ?capacityIncrement : oldCapacity);if (newCapacity - minCapacity < 0)newCapacity = minCapacity;if (newCapacity - MAX_ARRAY_SIZE > 0)newCapacity = hugeCapacity(minCapacity);elementData = Arrays.copyOf(elementData, newCapacity);
}










七 (LinkedList)

1 LinkedList容器介绍

(底层用双向链表实现的存储——>查询效率低,增删效率高,线程不安全)

双向链表也叫双链表,是链表的一种,它的每个数据节点中都有两个指针,分别指向前一个节点和后一个节点。 所以,从双向链表中的任意一个节点开始,都可以很方便地找到所有节点。

每个节点都应该有3部分内容:

class Node<E> {Node<E> previous;   //前一个节点E element;     //本节点保存的数据Node<E> next;        //后一个节点
}

List实现类的选用规则

如何选用ArrayList、LinkedList、Vector?

  1. 需要线程安全时,用Vector。
  2. 不存在线程安全问题时,并且查找较多用ArrayList(一般使用它)
  3. 不存在线程安全问题时,增加或删除元素较多用LinkedList






2 LinkedList容器的使用

(LinkedList实现了List接口,所以LinkedList是具备List的存储特征的(有序,元素有重复))

(自己独有的8个方法)

list标准

public class LinkedListTest {public static void main(String[] args) {//实例化LinkedList容器List<String> list = new LinkedList<>();//添加元素boolean a = list.add("a");boolean b = list.add("b");boolean c = list.add("c");list.add(3,"a");System.out.println(a+"\t"+b+"\t"+c);for(int i=0;i<list.size();i++){System.out.println(list.get(i));}}
}

非list标准——>自己独有的方法

方法说明
void addFirst(E e)将指定元素插入到开头
void addLast(E e)将指定元素插入到结尾
getFirst()返回此链表的第一个元素
getLast()返回此链表的最后一个元素
removeFirst()移除此链表中的第一个元素,并返回这个元素
removeLast()移除此链表中的最后一个元素,并返回这个元素
E pop()从此链表所表示的堆栈处弹出一个元素,等效于removeFirst
void push(E e)将元素推入此链表所表示的堆栈 这个等效于addFisrt(E e)
public class LinkedListTest2 {public static void main(String[] args) {System.out.println("-------LinkedList-------------");//将指定元素插入到链表开头LinkedList<String> linkedList1 = new LinkedList<>();linkedList1.addFirst("a");linkedList1.addFirst("b");linkedList1.addFirst("c");for (String str:linkedList1){System.out.println(str);}System.out.println("----------------------");//将指定元素插入到链表结尾LinkedList<String> linkedList = new LinkedList<>();linkedList.addLast("a");linkedList.addLast("b");linkedList.addLast("c");for (String str:linkedList){System.out.println(str);}System.out.println("---------------------------");//返回此链表的第一个元素System.out.println(linkedList.getFirst());//返回此链表的最后一个元素System.out.println(linkedList.getLast());System.out.println("-----------------------");//移除此链表中的第一个元素,并返回这个元素linkedList.removeFirst();//移除此链表中的最后一个元素,并返回这个元素linkedList.removeLast();for (String str:linkedList){System.out.println(str);}System.out.println("-----------------------");linkedList.addLast("c");//从此链表所表示的堆栈处弹出一个元素,等效于removeFirstlinkedList.pop();for (String str:linkedList){System.out.println(str);}System.out.println("-------------------");//将元素推入此链表所表示的堆栈  这个等效于addFisrt(E e)linkedList.push("h");for (String str:linkedList){System.out.println(str);}}
}








3 LinkedList源码分析

1 添加元素

节点类

private static class Node<E> {E item;Node<E> next;Node<E> prev;Node(Node<E> prev, E element, Node<E> next) {this.item = element;this.next = next;this.prev = prev;}
}

成员变量

transient int size = 0;/*** Pointer to first node.* Invariant: (first == null && last == null) ||*       (first.prev == null && first.item != null)*/
transient Node<E> first;/*** Pointer to last node.* Invariant: (first == null && last == null) ||*       (last.next == null && last.item != null)*/
transient Node<E> last;

添加元素

/*** Appends the specified element to the end of this list.** <p>This method is equivalent to {@link #addLast}.** @param e element to be appended to this list* @return {@code true} (as specified by {@link Collection#add})*/
public boolean add(E e) {linkLast(e);return true;
}/*** Links e as last element.*/
void linkLast(E e) {final Node<E> l = last;final Node<E> newNode = new Node<>(l, e, null);last = newNode;if (l == null)first = newNode;elsel.next = newNode;size++;modCount++;
}//创建新节点,头尾指针指向

2 头尾添加元素

addFirst

/*** Inserts the specified element at the beginning of this list.** @param e the element to add*/
public void addFirst(E e) {linkFirst(e);
}/*** Links e as first element.*/
private void linkFirst(E e) {final Node<E> f = first;final Node<E> newNode = new Node<>(null, e, f);first = newNode;if (f == null)last = newNode;elsef.prev = newNode;size++;modCount++;
}

addLast

/*** Appends the specified element to the end of this list.** <p>This method is equivalent to {@link #add}.** @param e the element to add*/
public void addLast(E e) {linkLast(e);
}/*** Links e as last element.*/
void linkLast(E e) {final Node<E> l = last;final Node<E> newNode = new Node<>(l, e, null);last = newNode;if (l == null)first = newNode;elsel.next = newNode;size++;modCount++;
}

3 获取元素——>返回的不是对象是元素

/*** Returns the element at the specified position in this list.** @param index index of the element to return* @return the element at the specified position in this list* @throws IndexOutOfBoundsException {@inheritDoc}*/
public E get(int index) {checkElementIndex(index);return node(index).item;
}
private void checkElementIndex(int index) {if (!isElementIndex(index))throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}
/*** Tells if the argument is the index of an existing element.*/
private boolean isElementIndex(int index) {return index >= 0 && index < size;
}
/*** Returns the (non-null) Node at the specified element index.*/
Node<E> node(int index) {// assert isElementIndex(index);if (index < (size >> 1)) {					//增加查询效率Node<E> x = first;for (int i = 0; i < index; i++)x = x.next;return x;} else {Node<E> x = last;for (int i = size - 1; i > index; i--)x = x.prev;return x;}
}

相关文章:

Java——容器(单例集合)(上)

一 容器介绍 容器&#xff0c;是用来容纳物体、管理物体。生活中,我们会用到各种各样的容器。如锅碗瓢盆、箱子和包等 程序中的“容器”也有类似的功能&#xff0c;用来容纳和管理数据。比如&#xff0c;如下新闻网站的新闻列表、教育网站的课程列表就是用“容器”来管理 视频…...

如何配置Github并在本地提交代码

前提: 可以流畅访问github, 需要一些上网技巧, 这就自行处理了 申请一个github账号 Github官网地址 首先就是邮箱注册啦, github没有对邮箱的限制, 只要是能收邮件的就ok, qq邮箱, 163等都可以使用. 然后和普通注册账号一样, 一路填写需要的信息, 验证邮箱即可. 如何新增代…...

工作bug,keil5编译器,理解int 类型函数返回值问题,详解!!!

编写不易&#xff0c;禁止搬运&#xff0c;仅供学习&#xff0c;感谢理解 问题现象 下面是一个在keil5里面写的一个&#xff0c;int类型的返回值函数&#xff0c;这个函数里面&#xff0c;只有if else if else这三个判断条件语句&#xff0c;正常来说任何情况下&#xff0c;…...

简明速通Java接口

前言 欢迎来到我的博客 个人主页:北岭敲键盘的荒漠猫-CSDN博客 本文从代码层面直接整理Java接口 让老油子们无需再理解繁杂的概念了。 Java接口在代码层面是做什么的 说白了老铁&#xff0c;Java的接口就是一个类&#xff0c;这个类中只能声明属性和方法&#xff0c;属性需要…...

MVC基础——市场管理系统(二)

文章目录 项目地址三、Produtcts的CRUD3.1 Products列表的展示页面(Read)3.1.1 给Product的Model里添加Category的属性3.1.2 View视图里展示Product List3.2 增加Product数据(Add)3.2.1 创建ViewModel用来组合多个Model3.2.2 在_ViewImposts里引入ViewModels3.2.3 添加Add的…...

java------------常用API preiod duration 计算时间差

1&#xff0c;preiod 如果末天数比初天数小&#xff0c;需要进一位 package API;import java.time.LocalDate; import java.time.Period;public class preiod {public static void main(String[] args) {// 计算时间差// LocalDate获取对象其中的一个方法LocalDate d1 LocalD…...

使用 FAISS 进行高效相似性搜索:从文本检索到动态数据处理

在现代数据科学和人工智能应用中&#xff0c;处理大量高维数据并从中找到相似项是一个常见任务。无论是在推荐系统、搜索引擎&#xff0c;还是在自然语言处理应用中&#xff0c;如何高效地进行相似性搜索&#xff08;Similarity Search&#xff09;一直是一个挑战。为了解决这个…...

执行“go mod tidy”遇到“misbehavior”错误

执行“go mod tidy”报错下错误&#xff0c;执行“go clean -modcache”和删除“go env GOMODCACHE”指定目录均无效&#xff1a; SECURITY ERROR go.sum database server misbehavior detected!old database:go.sum database tree3397826xyyhzdyAOat5li/EXx/MK1gONQf3LAGqArh…...

深入详解人工智能机器学习:强化学习

目录 强化学习概述 强化学习的基本概念 定义 关键组件 强化学习过程 常用算法 应用示例 示例代码 代码解释 应用场景 强化学习核心概念和底层原理 核心概念 底层原理 总结 强化学习概述 强化学习&#xff08;Reinforcement Learning, RL&#xff09;是机器学习中的…...

力扣打卡11:合并区间(比较器内联,引用传参的优化)

链接&#xff1a;56. 合并区间 - 力扣&#xff08;LeetCode&#xff09; 这道题可以用贪心。 首先将intervals的left&#xff08;intervals[i][0]&#xff09;排序。 然后拿出第一个区间&#xff0c;比较后面相邻的区间&#xff1a; 当前right<后left&#xff0c;表示下一…...

《 bilibili-起步级 用户模块接口文档 经验分享 ~》

bilibili - 用户模块接口文档 - 经验分享 ~ 数据库er关系图 : 迅速跳转链接 枚举码实体类 : 迅速跳转链接 使用apifox.json格式导入接口文档 步骤 登录Apifox。新建文件, 将代码粘贴到该文件, 并更改后缀为 .apifox.json进入项目&#xff0c;点击“导入”。选择“Apifox”格式…...

AES 与 SM4 加密算法:深度解析与对比

&#x1f9d1; 博主简介&#xff1a;CSDN博客专家&#xff0c;历代文学网&#xff08;PC端可以访问&#xff1a;https://literature.sinhy.com/#/literature?__c1000&#xff0c;移动端可微信小程序搜索“历代文学”&#xff09;总架构师&#xff0c;15年工作经验&#xff0c;…...

启保停电路如何接到PLC

传感器&#xff1a;NPN :棕&#xff1a;正 蓝&#xff1a;负 黑&#xff1a;信号 1M——>24V PNP&#xff1a;1M——>0V...

HTTP multipart/form-data 请求

序言 最近在写项目的过程中有一个需求是利用 HTTP 协议传输图片和视频&#xff0c;经过查询方法相应的方法发现使用 multipart/form-data 的方式&#xff0c;这是最常见处理二进制文件的表单编码类型。  学习了一下午&#xff0c;现在总结一下使用的方法和相关的知识点&#x…...

配置服务器的免密登录

在服务器中配置别名和免密登录 如果没有生成过公钥和密钥 ssh-keygen然后就生成了公钥和密钥&#xff0c;下一步进入.ssh文件夹 cd .ssh/可以看到文件夹中会多出来三个文件 id_rsa&#xff1a;密钥id_rsa.pub&#xff1a;公钥known_hosts&#xff1a;A通过ssh首次连接到B&am…...

普通遥控电动遮阳雨棚怎么接入米家并用苹果手机Siri控制

环境&#xff1a; 遥控电动遮阳雨棚 无线射频拷贝器 米家APP 问题描述&#xff1a; 普通遥控电动遮阳雨棚怎么接入米家并用苹果手机Siri控制 解决方案&#xff1a; 1.先看看遥控器射频参数,有些在里面板子上&#xff0c;要拆开才能看到&#xff0c;我这是433的 2.到网店…...

两种不同简缩极化的六个方程

方程1 (3*A*(b - a*1i 1) - A*((c d*1i)*(f1 f2*1i)*1i - (c d*1i)^2))*(a - b*1i)*1i 3*A*(b - a*1i 1) 2*(A*(c f2 d*1i - f1*1i) A*(c d*1i - (a b*1i)*(c d*1i)*1i))*(c - d*1i) (A*(c f2 d*1i - f1*1i) A*(c d*1i - (a b*1i)*(c d*1i)*1i))*(f1 - f2…...

环形缓冲区(Ring Buffer):概念、功能、使用场景与实现

一、概念 环形缓冲区&#xff08;Ring Buffer&#xff09;&#xff0c;又称循环缓冲区&#xff0c;是一种用于数据缓冲的数据结构。其核心思想是将缓冲区视为一个环形结构&#xff0c;当数据写入到缓冲区的末尾时&#xff0c;会自动回绕到缓冲区的开头继续写入&#xff0c;形成…...

大连理工大学数据结构2003年硕士入学试题

大连理工大学2003年硕士入学试题 数据结构部分(共75分) 一、回答下列问题(20分) 1&#xff0e;循环队列用数组A[0&#xff0e;&#xff0e;m—1)存放其数据元素。设tail指向其实际的队尾&#xff0c;front指向其实际队首的前一个位置&#xff0c;则当前队列中的数据元素有多少个…...

Master EDI 项目需求分析

Master Electronics 通过其全球分销网络&#xff0c;支持多种采购需求&#xff0c;确保能够为客户提供可靠的元件供应链解决方案&#xff0c;同时为快速高效的与全球伙伴建立合作&#xff0c;Master 选择通过EDI来实现与交易伙伴间的数据传输。 EDI为交易伙伴之间建立了一个安…...

图海寻径——图相关算法的奇幻探索之旅

一、图的表示 1. 邻接矩阵 (Adjacency Matrix) #include <iostream> #include <vector> #include <queue> #include <limits>using namespace std;class GraphMatrix { private:int numVertices;vector<vector<int>> adjMatrix;const st…...

亚马逊云科技re:Invent:生成式AI与全球布局

作为全球云计算和人工智能领域一年一度的顶级盛宴&#xff0c;亚马逊云科技2024 re:Invent全球大会吸引了超过6万名现场观众以及40多万名线上参会者。而大会上生成式AI的相关话题和内容&#xff0c;也成为了所有观众关注的焦点。 大会期间&#xff0c;亚马逊云科技全球服务副总…...

Android 因为混淆文件配置,打release包提示running R8问题处理

一、报错信息 Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in E:\workplace\xxxxxx\app\build\outputs\mapping\release\missing_rules.txt. Missing class org.mediakit.R$layout (refer…...

20241209给Ubuntu20.04系统的的交换分区增加为20GB的步骤

20241209给Ubuntu20.04系统的的交换分区增加为20GB的步骤 2024/12/9 21:10 缘起&#xff0c;编译中科创达的高通CM6125模块的Android10的时候&#xff0c;老报错。 编译环境可以编译荣品的RK3566的Android13/Buildroot。 以前荣品的RK3566的Android13的编译环境是可以编译通CM6…...

Centos7环境下nifi单机部署

Centos7环境下nifi单机部署 前言一、安装Nifi1.1 下载并解压1.2 修改配置文件 二、启动Nifi程序三、Nifi的简单使用3.1 文件移动3.2 本地文件传到HDFS 参考博客 前言 本以为在服务器上部署nifi很简单&#xff0c;跟着教程走就好&#xff0c;但是并没有成功&#xff0c;可能是因…...

如何通过轻易云实现金蝶云星空与旺店通数据集成

案例分享&#xff1a;柏为金蝶退料申请退料开单08.03 在企业的供应链管理中&#xff0c;数据的准确性和实时性至关重要。本文将重点介绍如何通过轻易云数据集成平台&#xff0c;将金蝶云星空的数据高效集成到旺店通旗舰奇门系统中&#xff0c;以实现柏为金蝶退料申请退料开单0…...

OSG开发笔记(三十七):OSG基于windows平台msvc2017x64编译器官方稳定版本OSG3.4.1搭建环境并移植Demo

​若该文为原创文章&#xff0c;未经允许不得转载 本文章博客地址&#xff1a;https://blog.csdn.net/qq21497936/article/details/144258047 各位读者&#xff0c;知识无穷而人力有穷&#xff0c;要么改需求&#xff0c;要么找专业人士&#xff0c;要么自己研究 长沙红胖子Qt…...

2024最新小猫咪PHP加密系统源码V1.4_本地API接口_带后台

2024最新小猫咪PHP加密系统源码V1.4_本地API接口_带后台 小猫咪PHP加密系统历时半年&#xff0c;它再一次迎来更新&#xff0c;更新加密算法&#xff08;这应该是最后一次更新加密算法了&#xff0c;以后主要更新都在框架功能上面了&#xff09;&#xff0c;适配php56-php74&a…...

K8S OOM killer机制

当kubelet没来得及触发pod驱逐&#xff0c;使得节点内存耗尽时&#xff0c;将触发节点上的OOM killer机制&#xff1b; Linux上有个机制叫OOM killer&#xff08;Out Of Memory killer&#xff09;&#xff0c;这个机制会在系统内存耗尽的情况下发挥作用&#xff0c;即根据一定…...

什么是绩效文化?

绩效文化是一种组织文化&#xff0c;它将绩效视为核心价值观&#xff0c;贯穿于组织的各个层面和活动之中。 一、绩效文化的内涵 目标导向 绩效文化强调组织成员都朝着共同的目标努力。这个目标通常是明确、可衡量的&#xff0c;如企业的年度利润目标、市场份额增长目标等。例…...