随笔分类 -  Java学习

摘要:public class StreamDemo { public static void main(String[] args) { //创建一个集合 ArrayList<String> list = new ArrayList<>(); list.add("赵敏"); list.add("张无忌" 阅读全文
posted @ 2020-06-19 15:31 硬盘红了 阅读(638) 评论(0) 推荐(0)
摘要:不使用Stream流完成上述操作代码: public class StreamDemo { public static void main(String[] args) { //创建一个集合,存储多个字符串元素 ArrayList<String> list = new ArrayList<>(); 阅读全文
posted @ 2020-06-19 14:52 硬盘红了 阅读(141) 评论(0) 推荐(0)
摘要:public class FunctionTest { public static void main(String[] args) { String s = "林青霞,30"; convert(s, s1 -> s1.split(",")[1], s1 -> Integer.parseInt(s1 阅读全文
posted @ 2020-06-08 18:27 硬盘红了 阅读(133) 评论(0) 推荐(0)
摘要: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 硬盘红了 阅读(389) 评论(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 硬盘红了 阅读(142) 评论(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 硬盘红了 阅读(253) 评论(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)
摘要:定义接口 public interface StudentBuilder { Student build(String name, int age); } View Code 测试类 public class StudentDemo { public static void main(String[ 阅读全文
posted @ 2020-05-19 17:53 硬盘红了 阅读(135) 评论(0) 推荐(0)
摘要:接口定义 public interface MyString { String mySubString(String s,int x,int y); } View Code 测试类 public class MyStringDemo { public static void main(String[ 阅读全文
posted @ 2020-05-19 17:11 硬盘红了 阅读(435) 评论(0) 推荐(0)
摘要:接口定义 public interface Print { void printUpperCase(String s); } View Code PrintString类 public class PrintString { public void printUpper(String s){ Str 阅读全文
posted @ 2020-05-19 16:47 硬盘红了 阅读(546) 评论(0) 推荐(0)
摘要:接口定义 public interface Converter { int convert(String s); } View Code 测试类定义 public class ConverterDemo { public static void main(String[] args) { //使用L 阅读全文
posted @ 2020-05-15 20:27 硬盘红了 阅读(277) 评论(0) 推荐(1)
摘要:接口定义 public interface Printable { void printString(String s); } 测试类 public class PrintableDemo { public static void main(String[] args) { //使用Lambda表达 阅读全文
posted @ 2020-05-15 18:01 硬盘红了 阅读(103) 评论(0) 推荐(0)
摘要:接口定义 public interface Addable { int add(int x , int y); } public interface Flyable { void fly(String s); } View Code 测试类定义 public class LambdaDemo { p 阅读全文
posted @ 2020-05-15 15:24 硬盘红了 阅读(581) 评论(0) 推荐(0)
摘要:接口定义 public interface Addable { int add(int x, int y); } View Code 测试类定义 public class AddableDemo { public static void main(String[] args) { //匿名内部类 / 阅读全文
posted @ 2020-05-15 15:00 硬盘红了 阅读(243) 评论(0) 推荐(0)
摘要:接口定义 public interface Flyable { void fly(String s); } View Code 测试类 public class FlyableDemo { public static void main(String[] args) { //使用匿名内部类 useF 阅读全文
posted @ 2020-05-15 13:01 硬盘红了 阅读(179) 评论(0) 推荐(0)