摘要:
StringBUilder是线程不安全的(线程同步访问的时候会出问题),但是效率相对较高。 (String类型使用加号进行拼接字符串的时候,会产生很多临时字符串对象。) StringBuffer是线程安全的。(StringBUffer只会产生一个对象) 阅读全文
posted @ 2019-10-10 23:13
Shawn_Michaels
阅读(152)
评论(0)
推荐(0)
摘要:
1 StringBuilder a = new StringBuilder("This is testDemo"); 2 String b = "Hello"+a; //将StringBuilder类型转换成String类型 3 StringBuilder a = new StringBuilder(a); //将String类型转换为StringBuilder类... 阅读全文
posted @ 2019-10-10 23:10
Shawn_Michaels
阅读(4187)
评论(0)
推荐(0)
摘要:
我们在开发过程中经常会使用到List<Object> list=new ArrrayList<>(); 这个集合,Object 也可以是String、Integer等。 当我们需要把list集合中的数据放到另外一个集合中(List、Set...),我们也许会使用循环遍历然后将对象存入到新的集合中,这 阅读全文
posted @ 2019-10-10 23:07
Shawn_Michaels
阅读(1159)
评论(0)
推荐(1)
摘要:
方法一:调用map.keySet()方法 方法二:调用map.entrySet()方法 常用 方法三:迭代器遍历 方法四:遍历map集合中的所有value值(该方法不能遍历操作key值) 阅读全文
posted @ 2019-10-10 22:48
Shawn_Michaels
阅读(668)
评论(0)
推荐(0)
摘要:
Object也是有自己的类型的,如果直接对Object类型的数据强转为Integer会出现类型转换异常 Object类型转换为Integer类型的两种方法:(先把Object类型通过toString()或者String.valueof()转换为String类型,然后在通过Integer工具类调用方法 阅读全文
posted @ 2019-10-10 09:58
Shawn_Michaels
阅读(23288)
评论(1)
推荐(2)