789
Posted ftl1012
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了789相关的知识,希望对你有一定的参考价值。
1. map
1.1. map中的方法
wpsB935.tmp
1.2. Map.Entry
对于集合来讲,就是把kye-value的数据保存在了Map.Entry的实例之后,再在Map集合中插入了一个Map.Entry的实例化对象
Map.Entry一般用于输出集合
wpsB946.tmpwpsB947.tmp
wpsB948.tmp
1.3. Map接口的常用子类
wpsB959.tmp
1.4. HashTable和HashMap区别
wpsB95A.tmp
1.5. Map的标准输出(2个)
方案一:
wpsB95B.tmp
方案二:
wpsB96B.tmp=package com.ftl;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
public class map {
public static void main(String[] args){
Map<String,String>map = new TreeMap<>();
map.put("Hello", "world");
map.put("Hello1", "world1");
map.put("Hello2", "world2");
map.put("Hello3", "world3");
String str = map.get("Hello");
Set<String> set = map.keySet();
Collection<String> values = map.values();
Iterator<String> iterator = set.iterator();
Iterator<String> iter = values.iterator();
System.out.println("
foreach方法:");
for (String s : values) {
System.out.print(s+"、");
}
System.out.println("
Iterator方法:");
while(iterator.hasNext()){
System.out.print(iterator.next()+"、");
}
System.out.println("
Map的标准输出_1(Map.entrySet):");
Set<Entry<String,String>> entrySet = map.entrySet();
Iterator<Map.Entry<String, String>> it = entrySet.iterator();
while(it.hasNext()){
Map.Entry<String, String> next = it.next();
System.out.print(next.getKey()+"-->: "+next.getValue()+"
");
}
System.out.println("
Map的标准输出_2(Foreach):");
for (Map.Entry<String, String> entry : entrySet) {
System.out.print(entry.getKey()+"-->: "+entry.getValue()+"
");
}
System.out.println("Map.entrySet()大小:"+map.entrySet().size());
}
}
1.6. 人员配置
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
public class map {
public static void main(String[] args){
Map<String,String>map = new TreeMap<>();
map.put("Hello", "world");
map.put("Hello1", "world1");
map.put("Hello2", "world2");
map.put("Hello3", "world3");
String str = map.get("Hello");
Set<String> set = map.keySet();
Collection<String> values = map.values();
Iterator<String> iterator = set.iterator();
Iterator<String> iter = values.iterator();
System.out.println("
foreach方法:");
for (String s : values) {
System.out.print(s+"、");
}
System.out.println("
Iterator方法:");
while(iterator.hasNext()){
System.out.print(iterator.next()+"、");
}
System.out.println("
Map的标准输出_1(Map.entrySet):");
Set<Entry<String,String>> entrySet = map.entrySet();
Iterator<Map.Entry<String, String>> it = entrySet.iterator();
while(it.hasNext()){
Map.Entry<String, String> next = it.next();
System.out.print(next.getKey()+"-->: "+next.getValue()+"
");
}
System.out.println("
Map的标准输出_2(Foreach):");
for (Map.Entry<String, String> entry : entrySet) {
System.out.print(entry.getKey()+"-->: "+entry.getValue()+"
");
}
System.out.println("Map.entrySet()大小:"+map.entrySet().size());
}
}
以上是关于789的主要内容,如果未能解决你的问题,请参考以下文章
SqlServer 替换字符,比如:12345(789),替换成:789,其中括号有可能是全角(),也有可能是半角()
c:\>123.txt 456.txt 789 cmd.exe 程序中拷贝的问题