楼主: ReneeBK
2543 27

[Ken Kousen]Modern Java Recipes [推广有奖]

  • 1关注
  • 62粉丝

VIP

已卖:4901份资源

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49675 个
通用积分
56.1287
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57805 点
帖子
4005
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

楼主
ReneeBK 发表于 2017-6-26 22:58:21 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

本帖隐藏的内容

1 (1).pdf (2.89 MB, 需要: 5 个论坛币)


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Recipes Modern Recipe Moder mode Java

本帖被以下文库推荐

沙发
ReneeBK(未真实交易用户) 发表于 2017-6-26 22:59:43
  1. Example 1-1. Anonymous Inner Class Implementation of Runnable
  2. public class RunnableDemo {
  3. public static void main(String[] args) {
  4. // Works in Java 7 or earlier:
  5. new Thread(new Runnable() {
  6. @Override
  7. public void run() {
  8. System.out.println(
  9. "inside runnable using an anonymous inner class"
  10. }
  11. }).start();
  12. }
  13. }
复制代码

藤椅
ReneeBK(未真实交易用户) 发表于 2017-6-26 23:01:18
Example 1-2. Using a lambda expression in a Thread constructor
  1. public class RunnableDemo {
  2. public static void main(String[] args) {
  3. new Thread(() -> System.out.println(
  4. "inside Thread constructor using lambda")).start();
  5. }
  6. }
  7. The syntax uses an arrow to separate the arguments (since there are zero
  8. arguments here, only a pair of empty parentheses is used) from the body. In this
  9. case, the body consists of a single line, so no braces are required. This is
  10. known as an expression lambda. Whatever value the expression evaluates to is
  11. returned automatically. In this case, since println returns void, the return
  12. from the expression is also void, which matches the return type of the run
  13. method.
复制代码

板凳
ReneeBK(未真实交易用户) 发表于 2017-6-26 23:02:56
Example 1-3. Assigning a lambda expression to a variable
  1. Example 1-3. Assigning a lambda expression to a variable
  2. public class RunnableDemo {
  3. public static void main(String[] args) {
  4. Runnable r = () -> System.out.println(
  5. "lambda expression implementing the run method");
  6. new Thread(r).start();
  7. }
  8. }
复制代码

报纸
ReneeBK(未真实交易用户) 发表于 2017-6-26 23:05:37
Example 1-4. An anonymous inner class implementation of FilenameFilter
  1. Example 1-4. An anonymous inner class implementation of FilenameFilter
  2. import java.io.File;
  3. import java.io.FilenameFilter;
  4. import java.util.Arrays;
  5. public class UseFilenameFilter {
  6. public static void main(String[] args) {
  7. File directory = new File("./src/main/java");
  8. // Anonymous inner class
  9. String[] names = directory.list(new FilenameFilter() {
  10. @Override
  11. public boolean accept(File dir, String name) {
  12. return name.endsWith(".java");
  13. }
  14. });
  15. System.out.println(Arrays.asList(names));
  16. }
  17. }
复制代码

地板
ReneeBK(未真实交易用户) 发表于 2017-6-26 23:07:38
Example 1-5. Lambda expression implementing FilenameFilter
  1. Example 1-5. Lambda expression implementing FilenameFilter
  2. import java.io.File;
  3. import java.io.FilenameFilter;
  4. import java.util.Arrays;
  5. public class UseFilenameFilter {
  6. public static void main(String[] args) {
  7. File directory = new File("./src/main/java");
  8. // Use lambda expression instead
  9. String[] names = directory.list((dir, name) -> name.endsWith
  10. System.out.println(Arrays.asList(names));
  11. }
  12. }
复制代码

7
h2h2(未真实交易用户) 发表于 2017-6-27 12:30:08
  1. Example 4-1. Reference implementation of Stream.of
  2. @SafeVarargs
  3. public static<T> Stream<T> of(T... values) {
  4. return Arrays.stream(values);
  5. }
  6. Tip
  7. The @SafeVarargs annotation is part of Java generics. It comes up when you
  8. have an array as an argument, because it is possible to assign a typed array to
  9. an Object array and then violate type safety with an added element. The
  10. @SafeVarargs annotation tells the compiler that the developer promises not to
  11. do that. See [Link to Come] for additional details.
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

8
shanghai8384(未真实交易用户) 发表于 2017-6-27 12:36:07
  1. Example 4-2. Creating a stream using Stream.of
  2. String names = Stream.of("Gomez", "Morticia", "Wednesday", "Pugsley"
  3. .collect(Collectors.joining(","));
  4. System.out.println(names);
  5. // prints Gomez,Morticia,Wednesday,Pugsley
  6. The API also includes an overloaded of method that takes a single element T
  7. t. This method returns a singleton sequential stream containing a single
  8. element.
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

9
Nicolle(未真实交易用户) 学生认证  发表于 2017-8-7 03:25:07
提示: 作者被禁止或删除 内容自动屏蔽

10
Nicolle(未真实交易用户) 学生认证  发表于 2017-8-7 03:25:47

Example 4-4. Creating a stream using Stream.iterate

提示: 作者被禁止或删除 内容自动屏蔽

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-2-4 05:24