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);
}
}
}
}
查看全文
相关阅读:
博客园页面设置(转载)
正则表达式30分钟入门教程 (转载)
如何写出优雅的代码
centos7 nginx+php5.6+mysql安装与配置
git 进阶
js 异步解决方案
行动派
unicode 与 utf-8
bower command not found--windows
click事件细节
原文地址:https://www.cnblogs.com/wf225/p/1037811.html
最新文章
栈ADT
arithmetic-02
arithmetic
函数柯里化浅解
函数参数传递方式:按值传递
变量对象和活动对象有什么区别.
CSS.flex见解
原型链解释
Vscode power shell 乱码
git checkout **** 的错误
热门文章
代码简化感受。
git-commit的一些学习感受
mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))
jQuery 弹出层脚本
深度工作:充分使用每一份脑力--转载
php实用函数
工作流、字段公式模式(业务)
php实现隐藏字符串的功能
学习技术的三条铁律
lnmp环境的安装
Copyright © 2011-2022 走看看