Stack和stack<T>方法一样
// 管理方式: 后进先出 LIFO 栈
// Stack<string> s=new Stack<string>();//(放一种类型成员)
// Stack s=new Stack();
// s.Push ();(添加成员)
// Console.WriteLine (s.Count);(输出数组长度)
// Console.WriteLine ((string)s.Pop ());(移除一个(后进先出)成员 并返回)
// Console.WriteLine (s.Peek ());(把栈顶的成员返回 但是不移除)
// Console.WriteLine (s.Contains ("许秋石"));contains 返回一个BOOL 判断栈中是否有这个参数
// s.Clear ();(清空成员)

// Queue和 Queue<T>
// 管理方式: 先进先出 FIFO 队列
// Queue q = new Queue ();
// Queue<string> q = new Queue<string> ();
// q.Enqueue ("ad石");(添加成员)
// Console.WriteLine (q.Count);(数组长度)
// Console.WriteLine (q.Dequeue ());(返回队列顶部的病移除)
// Console.WriteLine (q.Contains ("石"));(是否包含 这个成员)
// q.Clear();(移除全部成员)

// Dictionary<string, int> dic = new Dictionary<string,int>();
// 其中 第一个占位是键位 第二个是value的值;
// dic.Add(1,"213")(添加成员)
// dic.TryGetValue(1) 获取与指定的键相关联的值。 返回真或假
// dic.Remove(2)从 Dictionary<TKey, TValue> 中移除所指定的键的值。
// dic.ContainsKey(2)确定 Dictionary<TKey, TValue> 是否包含指定的键。
// dic.ContainsValue("213") 确定 Dictionary<TKey, TValue> 是否包含特定值。
// dic.Count 获取Stack中包含的元素。
// dic.Keys 获取包含 Dictionary<TKey, TValue> 中的键的集合
// dic.Values 获取包含 Dictionary<TKey, TValue> 中的值的集合

// ArrayList和List<T>
// ArrayList arr = new ArrayList ();
// List<T> arr = new List<> ();
// arr.Add ("adf");(添加成员)
// arr.Insert (2, p3);//插入指定位置一个相同成员
// per.Remove (p3);//移除相同值得成员
// per.RemoveAt (0);//移除指定位置的成员
// Console.WriteLine (per.RemoveAll (a => a.age > 40));//根据参数中传递的条件删除满足条件的对象,返回删除的个数
//per.Reverse ();//反向输出
// Console.WriteLine (per.IndexOf (p1));//搜索指定的对象返回他的下标
// Console.WriteLine (per.Sort(p1.name.CompareTo));
// Console.WriteLine (per.Contains (p1));//返回是否包含指定的对象
// per.Clear ();//移除所有成员
// Console.WriteLine (per.Count);//数组的长度

集合的概念 Stack和Queue Dictionary ArrayList和List<T>方法及用法的更多相关文章

  1. 常用数据结构及复杂度 array、LinkedList、List、Stack、Queue、Dictionary、SortedDictionary、HashSet、SortedSet

    原文地址:http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html  常用数据结构的时间复杂度 ...

  2. Java集合的Stack、Queue、Map的遍历

    Java集合的Stack.Queue.Map的遍历   在集合操作中,常常离不开对集合的遍历,对集合遍历一般来说一个foreach就搞定了,但是,对于Stack.Queue.Map类型的遍历,还是有一 ...

  3. 特殊集合(stack、queue、hashtable的示例及练习)

    特殊集合:stack,queue,hashtable stack:先进后出,一个一个的赋值一个一个的取值,按照顺序. .count           取集合内元素的个数 .push()        ...

  4. Java集合框架(三)—— List、ArrayList、Vector、Stack

    List接口 List集合代表一个有序集合,集合中每一个元素都有其对应的顺序索引.List集合容许使用重复元素,可以通过索引来访问指定位置的集合对象. ArrayList和Vector实现类 Arra ...

  5. 10-23C#基础--特殊集合(stack、queue、hashtable)

    特殊集合一:stack集合--堆集合 1.定义:堆集合是集合中一种特殊的类,在Stack中也有许多方法和属性,下面一一列举: 命名格式:Stack ss=new Stack(); 2.如何添加数据:p ...

  6. Java容器:Stack,Queue,PriorityQueue和BlockingQueue

    Stack Queue PriorityQueue BlockingQueue ArrayBlockingQueue LinkedBlockingQueue PriorityBlockingQueue ...

  7. Java集合框架(list,Queue)

    List和Queue都继承自Collection接口 list常规用法 List判断两个对象相等的标准:equals方法返回true class A2 { public boolean equals( ...

  8. java中List、Map、Set、Collection、Stack、Queue等的使用

    java中这几个东西是比较常用的,虽然我用的不多,也正是因为用的不多,所以我一直搞不清楚他们之间的具体用法以及相互之间的关系,现在特单独作为一个东西来总结一下. 本文参考一下资料: 1.<jav ...

  9. java中List、Map、Set、Stack、Queue、Collections等的使用

    java中List.Map.Set.Stack.Queue.Collections等的使用 List 创建方法: List<String> list=new ArrayList<&g ...

随机推荐

  1. logback

    logback:入口: private final static Logger logger = org.slf4j.LoggerFactory.getLogger(ServiceTest.class ...

  2. deep learning 练习 多变量线性回归

    多变量线性回归(Multivariate Linear Regression) 作业来自链接:http://openclassroom.stanford.edu/MainFolder/Document ...

  3. SQL2008 清除日志

    USE [master] GO ALTER DATABASE BizTest SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE BizTest SE ...

  4. RealTimePerformanceDemoView

    using System;using System.Diagnostics;using System.Timers;using System.Windows;using System.Windows. ...

  5. 哆啦A梦 canvas

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Python学习二(生成器和八皇后算法)

    看书看到迭代器和生成器了,一般的使用是没什么问题的,不过很多时候并不能用的很习惯 书中例举了经典的八皇后问题,作为一个程序员怎么能够放过做题的机会呢,于是乎先自己来一遍,于是有了下面这个ugly的代码 ...

  7. LeetCode-179. Largest Number

    179. Largest Number Given a list of non negative integers, arrange them such that they form the larg ...

  8. js工厂方式和构造函数

    工厂方式 //工厂方式 : 封装函数 function createPerson(name){ //1.原料 var obj = new Object(); //2.加工 obj.name = nam ...

  9. 墨卡托投影C#实现

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  10. Mysql 第一天

    数据库课程体系 在PHP阶段,将数据库分为三个阶段: 基础阶段(就业班第一个阶段): 6天, mysql数据库的基本操作(增删改查), 以及一些高级操作(视图, 触发器,函数,存储过程等), 和PHP ...