set使用
package com.cz.test.util.collection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
public class Test {
public static void main(String[] args) {
Collection con=new ArrayList();
con.add("java");
con.add("C++");
con.add("C");
System.out.println(con.contains("java"));
//遍历
Iterator s=con.iterator();
while(s.hasNext()){//返回boolean值,
System.out.println(s.next());//一个一个输出
}
}
}
随机推荐
- set_include_path — 设置 include_path 配置选项为当前脚本设置 include_path 运行时的配置选项。
说明 string set_include_path ( string $new_include_path ) 为当前脚本设置 include_path 运行时的配置选项. 参数 new_includ ...
- 浮点数转换为人名币读法字符串(JAVA)
/*<java疯狂讲义>浮点数转换为人名币读法字符串这个用例,感觉没有考虑零的情况*/ import java.util.Arrays; public class Num2Rmb { pr ...
- ACM题目————Aggressive cows
Description Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stal ...
- Spring MVC 的汉字乱码问题
在web.xml文件加入 <filter> <filter-name>characterEncodingFilter</filter-name> <filte ...
- [转]android使用shape stroke描边只保留底部
在项目中遇到这种情况:由于一些原因,自己需要用LinearLayout的垂直布局做出ListView的那种效果,但是ListView是自带了分割线的,而且顶部底部都是没有分割线的,每个item中间都是 ...
- Uva 1599 最佳路径
题目链接:https://uva.onlinejudge.org/external/15/1599.pdf 题意: 保证在最短路的时候,输出字典序最小的路径. 方法: 路径上有了权值,可以利用图论的数 ...
- 切分vocab时遇到的问题
vocab的格式如下所示,每个词和对应100维的向量: </s> 0.004003 0.004419 -0.003830 -0.003278 0.001367 0.003021 0.000 ...
- 局域网无法访问vmware虚拟机WEB服务器解决办法
环境:虚拟机服务器是centos,apache+php+mysql环境,但是局域网无法访问 1.本机能ping通虚拟机 2.虚拟机也能ping通本机 3.虚拟机能访问自己的web 4.本机无法访问虚拟 ...
- js的解析--预处理(三)
js的解析与执行过程 分全局 {预处理阶段和执行阶段} 函数{预处理函数和执行阶段} 1/创建词法环境(环境上下文) LexicalEnvironment === window { } ...
- Educational Codeforces Round 1 A
In this problem you are to calculate the sum of all integers from 1 to n, but you should take all po ...