随笔分类 -  Java学习之函数式接口、Stream流、反射

摘要:public class FunctionDemo { public static void main(String[] args) { convert("100", s -> Integer.parseInt(s)); convert(100, i -> String.valueOf(i + 56 阅读全文
posted @ 2020-06-08 17:57 硬盘红了 阅读(608) 评论(0) 推荐(0)
摘要:public class PredicateTest { public static void main(String[] args) { String[] strArray = {"林青霞,30","柳岩,34","张曼玉,35","貂蝉,31","王祖贤,33"}; ArrayList<Stri 阅读全文
posted @ 2020-06-08 17:30 硬盘红了 阅读(219) 评论(0) 推荐(0)
摘要:public class PredicateDemo { public static void main(String[] args) { boolean b1 = checkString("hello", s -> s.length() > 8); System.out.println(b1); 阅读全文
posted @ 2020-06-08 15:55 硬盘红了 阅读(388) 评论(0) 推荐(0)
摘要:public class ConsumerTest { public static void main(String[] args) { String[] strArray = {"林青霞,30", "张曼玉,35", "王祖贤,40"}; printInfo(strArray, (String s 阅读全文
posted @ 2020-06-08 15:28 硬盘红了 阅读(163) 评论(0) 推荐(0)
摘要:public class ConsumerDemo { public static void main(String[] args) { operatorString("旭旭宝宝",s -> System.out.println(s)); operatorString("旭旭宝宝",s -> Sys 阅读全文
posted @ 2020-06-06 19:26 硬盘红了 阅读(542) 评论(0) 推荐(0)
摘要:public class SupplierTest { public static void main(String[] args) { //定义数组 int[] a = {10,20,33,12,99}; //调用方法获取最大值 int MaxValue = getMax(()->{ int Ma 阅读全文
posted @ 2020-06-06 18:57 硬盘红了 阅读(141) 评论(0) 推荐(0)
摘要:public class SupplierDemo { public static void main(String[] args) { String s = getString(()->"函数式接口"); System.out.println(s); Integer i = getInteger( 阅读全文
posted @ 2020-06-06 17:20 硬盘红了 阅读(146) 评论(0) 推荐(0)
摘要:public class ComparatorDemo { public static void main(String[] args) { ArrayList<String> array = new ArrayList<>(); array.add("a"); array.add("ccccc") 阅读全文
posted @ 2020-06-06 17:01 硬盘红了 阅读(250) 评论(0) 推荐(0)
摘要:public class RunnableDemo { public static void main(String[] args) { //使用匿名类调用方法 startThread(new Runnable() { @Override public void run() { System.out 阅读全文
posted @ 2020-06-05 16:18 硬盘红了 阅读(186) 评论(0) 推荐(0)