用ArrayList对数组进行排序
来源:互联网 发布:免费音乐视频制作软件 编辑:程序博客网 时间:2024/05/14 05:09
using System;
using System.Collections;
public class SamplesArrayList {
public static void Main() {
// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add( "The" );
myAL.Add( "quick" );
myAL.Add( "brown" );
myAL.Add( "fox" );
myAL.Add( "jumps" );
myAL.Add( "over" );
myAL.Add( "the" );
myAL.Add( "lazy" );
myAL.Add( "dog" );
// Displays the values of the ArrayList.
Console.WriteLine( "The ArrayList initially contains the following values:" );
PrintValues( myAL );
// Sorts the values of the ArrayList.
myAL.Sort();
// Displays the values of the ArrayList.
Console.WriteLine( "After sorting:" );
PrintValues( myAL );
}
public static void PrintValues( IEnumerable myList ) {
foreach ( Object obj in myList )
Console.WriteLine( " {0}", obj );
Console.WriteLine();
}
}
/*
This code produces the following output.
The ArrayList initially contains the following values:
The
quick
brown
fox
jumps
over
the
lazy
dog
After sorting:
brown
dog
fox
jumps
lazy
over
quick
the
The
*/
- 用ArrayList对数组进行排序
- ArrayList对动态数组进行排序数组由Scanner后台动态接收数组元素
- 对数组进行排序
- 对数组进行排序
- 对数组进行排序
- 对ArrayList的自定义元素进行排序
- 使用Comparator对ArrayList进行排序
- 对ArrayList中某一元素进行排序
- 利用ArrayList对Hashtable其进行排序
- java中对ArrayList进行排序
- Java中对ArrayList进行排序
- java中对ArrayList进行排序
- java对arrayList中的元素进行排序
- 对ArrayList集合中的元素进行排序
- 用指针对数组进行排序
- 用指针数组对字符串进行排序
- 数据结构:用Java对数组进行排序
- 用qsort对二维数组进行排序
- 恢复被病毒禁用的任务管理器和注册表编辑器
- 如何给Windows Server 2003安装光盘集成SP1补丁包
- 解决了CSDN Bug,终于可以发表文章了。
- About the W32/Codbot-O —— DirectX Graphics (dxdmain)
- 解决了CSDN Bug,终于可以发表文章了。
- 用ArrayList对数组进行排序
- 有些歌,为什么只有放到广告里才好听----ipod nano广告歌----Feist >
- A scripting for rebooting system
- MSN尾巴病毒手工清除方法
- Cisco小失误,大麻烦
- 网络打印机安装脚本(rundll32 printui.dll,PrintUIEntry用法示例)
- Cisco小失误,大麻烦
- Cisco小失误,大麻烦
- 恢复被病毒禁用的任务管理器和注册表编辑器