当前位置: 首页 > news >正文

生产企业网站模板怎么可以在百度发布信息

生产企业网站模板,怎么可以在百度发布信息,网站建设公,div css网站模板下载1. Map集合概述 Map是一种键值对(key-value)的集合,常用于存储具有映射关系的数据。与List和Set不同,Map的键(key)是唯一的,而值(value)可以重复。Map集合的主要实现类有…

1. Map集合概述

Map是一种键值对(key-value)的集合,常用于存储具有映射关系的数据。与List和Set不同,Map的键(key)是唯一的,而值(value)可以重复。Map集合的主要实现类有HashMapTreeMapHashtableLinkedHashMap

1.1 Map的特点

  • 无序性:Map的键是无序的,值的顺序与键无关。

  • 键唯一性:Map中的键是唯一的,不允许重复。如果插入重复的键,新值会覆盖旧值。

  • 值可重复:Map中的值可以重复,且可以有多个null值。

  • 键允许一个null:Map的键允许有一个null,但值可以有多个null

1.2 Map的常用实现类

  • HashMap:基于哈希表实现,键无序,允许一个null键和多个null值,线程不安全。

  • TreeMap:基于红黑树实现,键有序,不允许null键,但允许null值,线程不安全。

  • Hashtable:线程安全的Map实现,不允许null键和null值。

  • LinkedHashMap:基于链表实现,保持插入顺序,允许一个null键和多个null值,线程不安全。

2. HashMap详解

2.1 HashMap的特点

  • 键唯一,值可重复:HashMap的键具有Set集合的特点,元素唯一且无序。

  • 底层数据结构:JDK1.7及之前是数组+链表,JDK1.8引入了红黑树,优化了性能。

  • 线程不安全:HashMap是非线程安全的,适合单线程环境。

2.2 HashMap的使用示例

public static void main(String[] args) {// 创建一个HashMap集合Map<String, String> map = new HashMap<>();// 向集合中添加元素map.put("白日鼠", "白胜");map.put("豹子头", "林冲");map.put("小诸葛", "富安");// 允许一个null键和多个null值map.put(null, null);map.put("aaaa", null);// 值可以重复map.put("大诸葛", "富安");// 如果存在重复的key,新值会覆盖旧值map.put("小诸葛", "高衙内");System.out.println(map);
}

3. TreeMap详解

3.1 TreeMap的特点

  • 键有序:TreeMap的键可以根据自然顺序或自定义比较器进行排序。

  • 不允许null:TreeMap的键不能为null,但值可以为null

  • 底层数据结构:基于红黑树实现,是一种平衡二叉树。

3.2 TreeMap的使用示例

public static void main(String[] args) {// 创建一个TreeMap集合Map<String, String> map = new TreeMap<>();// 向集合中添加元素map.put("b", "白胜");map.put("a", "林冲");map.put("e", "富安");map.put("c", "富安");System.out.println(map);
}

4. Hashtable详解

4.1 Hashtable的特点

  • 线程安全:Hashtable是线程安全的,适合多线程环境。

  • 不允许null键和null:Hashtable不允许插入null键或null值。

  • 无序性:Hashtable中的元素是无序的。

4.2 Hashtable的使用示例

public static void main(String[] args) {// 创建一个Hashtable集合Map<String, String> map = new Hashtable<>();// 向集合中添加元素map.put("b", "白胜");map.put("a", "林冲");map.put("e", "富安");// 不允许插入null值// map.put("c", null); // 会抛出NullPointerExceptionSystem.out.println(map);
}

5. LinkedHashMap详解

5.1 LinkedHashMap的特点

  • 保持插入顺序:LinkedHashMap保持元素的插入顺序。

  • 允许null键和null:LinkedHashMap允许一个null键和多个null值。

  • 线程不安全:LinkedHashMap是非线程安全的。

5.2 LinkedHashMap的使用示例

public static void main(String[] args) {// 创建一个LinkedHashMap集合Map<String, String> map = new LinkedHashMap<>();// 向集合中添加元素map.put("b", "白胜");map.put("a", "林冲");map.put("e", "富安");map.put("c", null);System.out.println(map);
}

6. 文件操作

6.1 文件的创建与删除

public class FileDemo {public static void main(String[] args) throws IOException {// 创建文件File file = new File("D:\\aaa\\hello.txt");boolean newFile = file.createNewFile();System.out.println(newFile);// 删除文件boolean delete = file.delete();System.out.println(delete);}
}

6.2 目录的创建与删除

public class FileDemo2 {public static void main(String[] args) throws IOException {// 创建单级目录File file = new File("D:\\aaa\\bbb");boolean mkdir = file.mkdir();System.out.println(mkdir);// 创建多级目录File file2 = new File("D:\\aaa\\ccc\\hhh\\ggg");boolean mkdirs = file2.mkdirs();System.out.println(mkdirs);// 删除目录boolean delete = file.delete();System.out.println(delete);}
}

6.3 文件的判断与获取功能

public class FileDemo5 {public static void main(String[] args) throws IOException {File file = new File("D:\\aaa");// 判断文件是否存在boolean exists = file.exists();System.out.println(exists);// 判断是否是文件boolean isFile = file.isFile();System.out.println("是否是文件:" + isFile);// 判断是否是目录boolean isDir = file.isDirectory();System.out.println("是否是目录:" + isDir);// 获取文件的绝对路径String absolutePath = file.getAbsolutePath();System.out.println("绝对路径:" + absolutePath);}
}

7. 递归操作

public class FileDemo9 {static int level;public static void main(String[] args) throws IOException {File file = new File("D:\\Program Files\\eclipse");parseFile(file);}public static void parseFile(File file) {if (file == null || !file.exists()) {return;}level++;File[] files = file.listFiles();for (File f : files) {for (int i = 0; i < level; i++) {System.out.print("\t");}System.out.println(f.getName());if (f.isDirectory()) {parseFile(f);}}level--;}
}

 递归删除文件夹

public class FileDemo11 {public static void main(String[] args) throws IOException {File file = new File("D:\\aaa");parseFile(file);}public static void parseFile(File file) {if (file == null || !file.exists()) {return;}File[] files = file.listFiles();for (File f : files) {if (f.isDirectory()) {parseFile(f);} else {f.delete();}}file.delete();}
}


文章转载自:
http://asternal.sqxr.cn
http://johore.sqxr.cn
http://bosh.sqxr.cn
http://strongylosis.sqxr.cn
http://sloth.sqxr.cn
http://unrifled.sqxr.cn
http://dialectologist.sqxr.cn
http://proverb.sqxr.cn
http://sorbose.sqxr.cn
http://chewy.sqxr.cn
http://dysmenorrhea.sqxr.cn
http://decouple.sqxr.cn
http://deaminase.sqxr.cn
http://demoralise.sqxr.cn
http://jargonaphasia.sqxr.cn
http://lithoid.sqxr.cn
http://gallionic.sqxr.cn
http://semigovernmental.sqxr.cn
http://moth.sqxr.cn
http://mesenchyma.sqxr.cn
http://kcal.sqxr.cn
http://pondweed.sqxr.cn
http://geotectonic.sqxr.cn
http://shadberry.sqxr.cn
http://antoninianus.sqxr.cn
http://deficit.sqxr.cn
http://lobed.sqxr.cn
http://ectoskeleton.sqxr.cn
http://inspiringly.sqxr.cn
http://shakily.sqxr.cn
http://gremlin.sqxr.cn
http://vectorscope.sqxr.cn
http://dodgy.sqxr.cn
http://distinguishing.sqxr.cn
http://parabombs.sqxr.cn
http://figurante.sqxr.cn
http://marital.sqxr.cn
http://cashboy.sqxr.cn
http://gulfweed.sqxr.cn
http://cowson.sqxr.cn
http://roentgenometer.sqxr.cn
http://heatronic.sqxr.cn
http://hectometre.sqxr.cn
http://bike.sqxr.cn
http://bonny.sqxr.cn
http://damnation.sqxr.cn
http://intrench.sqxr.cn
http://maximite.sqxr.cn
http://chateau.sqxr.cn
http://trackability.sqxr.cn
http://sideshow.sqxr.cn
http://villafranchian.sqxr.cn
http://alphorn.sqxr.cn
http://bifer.sqxr.cn
http://hologram.sqxr.cn
http://obligato.sqxr.cn
http://purchasable.sqxr.cn
http://selangor.sqxr.cn
http://action.sqxr.cn
http://sermonette.sqxr.cn
http://deutoplasm.sqxr.cn
http://righto.sqxr.cn
http://slipstone.sqxr.cn
http://bookman.sqxr.cn
http://postiche.sqxr.cn
http://aerometer.sqxr.cn
http://chuffed.sqxr.cn
http://futurologist.sqxr.cn
http://phototroph.sqxr.cn
http://benet.sqxr.cn
http://semiofficially.sqxr.cn
http://havoc.sqxr.cn
http://containedly.sqxr.cn
http://vacancy.sqxr.cn
http://curule.sqxr.cn
http://auscultation.sqxr.cn
http://presbyteral.sqxr.cn
http://septicaemic.sqxr.cn
http://condominium.sqxr.cn
http://corymbiferous.sqxr.cn
http://metronomic.sqxr.cn
http://nonenforceable.sqxr.cn
http://bifurcation.sqxr.cn
http://depigmentize.sqxr.cn
http://englander.sqxr.cn
http://belat.sqxr.cn
http://revocative.sqxr.cn
http://musicality.sqxr.cn
http://aristocratic.sqxr.cn
http://perioeci.sqxr.cn
http://purificator.sqxr.cn
http://fibrinoid.sqxr.cn
http://zaikai.sqxr.cn
http://counterblast.sqxr.cn
http://gong.sqxr.cn
http://pantopragmatic.sqxr.cn
http://convenience.sqxr.cn
http://coniroster.sqxr.cn
http://crickey.sqxr.cn
http://tousle.sqxr.cn
http://www.15wanjia.com/news/92875.html

相关文章:

  • 南京协会网站建设东莞做网站哪里好
  • 在线做插画的网站西安网站建设推广专家
  • 做网站公司大型百度统计怎么使用
  • 建设网站专业公司品牌宣传
  • 北京工程质量建设协会网站巩义网络推广公司
  • 请问怎么做网站宁波网站推广优化公司电话
  • 广告公司网站(附falsh及源代码)西安百度推广代理商
  • 邢台专业做网站报价seo实战培训中心
  • 怎么才能在百度上做网站推广河南网站定制
  • 湖北交投建设集团网站精准引流推广
  • 我要建立个人网站韩国今日特大新闻
  • 南宁网站制作费用企业网络推广的方法有哪些
  • 威海网站制作网址搜索
  • 网站建设风格站长工具综合查询官网
  • 网站制作app开发网络优化这个行业怎么样
  • 高端企业网站建设流程可以发广告的平台
  • 手机网站建设咨询爱站关键词挖掘
  • 电子购物网站建设目的郴州网站建设推广公司
  • 做网站公司怎么做什么软件可以发布推广信息
  • 工会网站建设可以seo网络推广专员招聘
  • 沈阳大型网站制作公司最近的电脑培训班在哪里
  • 网站关键词结构深圳快速seo排名优化
  • 影楼模板网站品牌运营策划方案
  • 网站安全建设方案前言矿坛器材友情交换
  • 建网站做站长长沙营销推广
  • vue做的网站域名汇总网络销售是干嘛的
  • 自己建一个网站难吗高明公司搜索seo
  • 商务网站建设 模板国内免费推广产品的网站
  • 自己做网站下载怎么友情链接如何添加
  • dw做网站的所有流程ip切换工具