zoukankan
html css js c++ java
C# 集合类(二):Queue
Queue
:队列,表示对象的先进先出集合。Enqueue方法入队列,Dequeue方法出队列。
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Collections;
namespace
ConsoleApplication1
{
class
Program
{
static
void
Main(
string
[] args)
{
Queue qu
=
new
Queue();
Queue qu2
=
new
Queue();
foreach
(
int
i
in
new
int
[
4
]
{
1
,
2
,
3
,
4
}
)
{
qu.Enqueue(i);
//
入队
qu2.Enqueue(i);
}
foreach
(
int
i
in
qu)
{
Console.WriteLine(i);
//
遍历
}
qu.Dequeue();
//
出队
Console.WriteLine(
"
Dequeue
"
);
foreach
(
int
i
in
qu)
{
Console.WriteLine(i);
}
qu2.Peek();
//
返回位于 Queue 开始处的对象但不将其移除。
Console.WriteLine(
"
Peek
"
);
foreach
(
int
i
in
qu2)
{
Console.WriteLine(i);
}
}
}
}
查看全文
相关阅读:
java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthIcon
微信数据库解密--代码报错:未定义标识符 HMAC_CTX_init
Windows家庭版组策略编辑
Visual Studio x64 使用 .asm 文件
某数据库管理软件离线注册分析
EV剪辑分析
ciscn_lonelywolf
arm-pwn
libc-2.32.so在orw上与其他版本的区别
更新libc
原文地址:https://www.cnblogs.com/wf225/p/1037811.html
最新文章
ACWing 289 环路运输
换根dp
ACWing 284 金字塔
最长公共上升子序列 LCIS
cf1
巧克力棒分割
括号匹配
数组查找值及索引的优先选择方式(方法)
npm包发布
ant design中table自定义选择项Table.SELECTION_ALL等,修改默认选项中文展示
热门文章
Proxy(代理)特性与Reflect
柯里化函数(形参个数确定与形参个数不确定)
reduce()的一些实用方法
模拟文件系统
SVProgressHUD在某些情况下不显示的问题解决办法
面试题-登录/注册测试用例设计
packages:error loading package list:status: 400
Yarn 日志聚合优化—摆脱 HDFS 依赖
Hive HMS Canary 时间较长异常分析
Spark 持久化介绍(cache/persist/checkpoint)
Copyright © 2011-2022 走看看