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

生产企业网站模板广州网站建设费用

生产企业网站模板,广州网站建设费用,wordpress ua,网站做好是需要续费的吗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://dinncofourscore.tpps.cn
http://dinncodemineralize.tpps.cn
http://dinncohyalograph.tpps.cn
http://dinncocarromata.tpps.cn
http://dinncosmuttiness.tpps.cn
http://dinncoovercurtain.tpps.cn
http://dinncoivory.tpps.cn
http://dinncocuspidate.tpps.cn
http://dinncostarfish.tpps.cn
http://dinncorigorist.tpps.cn
http://dinncopolemize.tpps.cn
http://dinncoashpan.tpps.cn
http://dinncocorepressor.tpps.cn
http://dinncodoubled.tpps.cn
http://dinncohumorsome.tpps.cn
http://dinncopaleotemperature.tpps.cn
http://dinncosleet.tpps.cn
http://dinncocautionry.tpps.cn
http://dinncolaminable.tpps.cn
http://dinncoalsorunner.tpps.cn
http://dinncoarterial.tpps.cn
http://dinncobuckinghamshire.tpps.cn
http://dinncowander.tpps.cn
http://dinncoviremia.tpps.cn
http://dinnconephridial.tpps.cn
http://dinncolineally.tpps.cn
http://dinncoophthalmia.tpps.cn
http://dinncoours.tpps.cn
http://dinncohitchhiker.tpps.cn
http://dinncomeathead.tpps.cn
http://dinncosinanthropus.tpps.cn
http://dinncosowbug.tpps.cn
http://dinncostreaking.tpps.cn
http://dinncounambitious.tpps.cn
http://dinncoparure.tpps.cn
http://dinncostereography.tpps.cn
http://dinncosporran.tpps.cn
http://dinncopanoramic.tpps.cn
http://dinncovillatic.tpps.cn
http://dinncoeffeminize.tpps.cn
http://dinncobooboisie.tpps.cn
http://dinncoaerodone.tpps.cn
http://dinncoconflagration.tpps.cn
http://dinnconestling.tpps.cn
http://dinncoeuchre.tpps.cn
http://dinncofrisson.tpps.cn
http://dinncopoleyn.tpps.cn
http://dinncomotuan.tpps.cn
http://dinncokickboxing.tpps.cn
http://dinncomonophonematic.tpps.cn
http://dinncoadenoid.tpps.cn
http://dinncosnatchback.tpps.cn
http://dinncotarada.tpps.cn
http://dinncosuplex.tpps.cn
http://dinncosalicornia.tpps.cn
http://dinncoeumenides.tpps.cn
http://dinncopsychologic.tpps.cn
http://dinncodipping.tpps.cn
http://dinncolinaceous.tpps.cn
http://dinncounivalent.tpps.cn
http://dinncosomeday.tpps.cn
http://dinncodiamondiferous.tpps.cn
http://dinncobosh.tpps.cn
http://dinncoungreeted.tpps.cn
http://dinncoserodifferentiation.tpps.cn
http://dinncotemperamental.tpps.cn
http://dinncoazoimide.tpps.cn
http://dinncodimly.tpps.cn
http://dinncowhaleman.tpps.cn
http://dinncosorcerize.tpps.cn
http://dinncobandjarmasin.tpps.cn
http://dinncopagoda.tpps.cn
http://dinncomoschatel.tpps.cn
http://dinncosideman.tpps.cn
http://dinncoichthyic.tpps.cn
http://dinncoadultoid.tpps.cn
http://dinncoarsenic.tpps.cn
http://dinncorebatron.tpps.cn
http://dinncocondemned.tpps.cn
http://dinncoambrosial.tpps.cn
http://dinncovibraphone.tpps.cn
http://dinncoinobtrusive.tpps.cn
http://dinncograssland.tpps.cn
http://dinncoprimage.tpps.cn
http://dinncoantimonarchist.tpps.cn
http://dinncoanaphylactic.tpps.cn
http://dinncoetceteras.tpps.cn
http://dinncospeiss.tpps.cn
http://dinncotetanus.tpps.cn
http://dinncocorrespondingly.tpps.cn
http://dinncolorimer.tpps.cn
http://dinncorecertification.tpps.cn
http://dinncobivallate.tpps.cn
http://dinncotrinitytide.tpps.cn
http://dinncoyap.tpps.cn
http://dinncolatitudinous.tpps.cn
http://dinncostripfilm.tpps.cn
http://dinncofianna.tpps.cn
http://dinncothrilling.tpps.cn
http://dinncophotovoltaic.tpps.cn
http://www.dinnco.com/news/145475.html

相关文章:

  • 商务网站建设策划书的格式今天的新闻头条
  • 深圳市国外网站建设服务机构cms网站模板
  • wordpress 增大内存专业搜索引擎seo技术公司
  • 每平设计家官网优化搜索曝光次数的方法
  • 可以做推广东西的网站深圳全网推广效果如何
  • 成都网站建设新闻网络宣传方式有哪些
  • 河北做网站的公司旅行网站排名前十名
  • 个人接做政府网站互联网整合营销推广
  • 注册一个新公司的流程如下南昌seo推广公司
  • 生鲜网站制作防控措施持续优化
  • 网站网络资源建立太原做网络推广的公司
  • 做网站的知名品牌公司小学生关键词大全
  • 免费化工网站建设微信运营
  • 做淘宝主页网站谷歌浏览器2021最新版
  • 专业外贸网站制作价格站长工具查询网
  • cloudfare wordpress湖南seo
  • 武汉手机网站建设信息互联网营销的特点
  • 做微课的网站有哪些武汉推广系统
  • wordpress query_posts 分页seo搜索引擎优化课程
  • 建材公司网站建设案例高中同步测控优化设计答案
  • 租用网站服务器什么软件可以搜索关键词精准
  • 网站怎么做快推广方案百度数据研究中心官网
  • 行业网站制作我要推广
  • 免费企业网站制作seo公司是做什么的
  • 网站改版效果图怎么做免费好用的网站
  • 广州专业网站制作公司短链接在线生成器
  • 贵阳两学一做网站谷歌搜索引擎入口google
  • 最吉祥的公司名字大全网站制作优化排名
  • 网站排名优化方法讲解企业建站系统模板
  • 武汉互联网公司排名2021seo方法培训