V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  Cbdy  ›  全部回复第 108 页 / 共 148 页
回复总数  2954
1 ... 104  105  106  107  108  109  110  111  112  113 ... 148  
❮ ❯
Java 的话,JDBC Template 这种抽象很合理了,等 Java12 出了,支持多行字符串就可以告别 MyBatis 了(当然,我现在也不用)

ORM 的话,用 JPA 吧。你这套东西,恕我直言,半吊子的设计
2018 年 10 月 10 日
回复了 Bestda 创建的主题 › 问与答 › 图书馆太冷了,有什么好的办法
空调了解一下
依赖注入的实质是代码生成,生成样板代码
2018 年 10 月 7 日
回复了 YTS 创建的主题 › Windows › Windows 10 1809 更新以后部分个人文件丢失
还是重装稳一点
2018 年 10 月 7 日
回复了 Oathbinder 创建的主题 › Java › 如何更省事地用 Java 写一个命令行交互的 CRUD 应用
给用户装一个 DataGrip
2018 年 10 月 7 日
回复了 ft3312591 创建的主题 › 程序员 › 关于 html5 的桌面通知,如何实现实时推送
sse 和 ws 都行吧,倾向于用 ws,灵活没跨域,可以弄一个专门的消息服务
2018 年 10 月 7 日
回复了 oldIron 创建的主题 › 职场话题 › 该如何处理这种压力
及时沟通,不要大恩成仇😄
2018 年 10 月 2 日
回复了 zsh1995 创建的主题 › Java › effective Java 已经有新版了,国内啥时候能引进?
求人不如求己,建议学好洋文
用自家的域名做一下 cname 很难吗?
2018 年 9 月 29 日
回复了 aLazarus 创建的主题 › 程序员 › 有时候和同事一起工作简直就是降低效率…
换 node,前后都自己写,没有这么多幺蛾子
2018 年 9 月 29 日
回复了 vjnjc 创建的主题 › 问与答 › 求问聊天信息该怎么存储?
tidb
2018 年 9 月 28 日
回复了 v2byy 创建的主题 › 程序员 › typora bug 有点多啊
你更新一下吧,现在最新是 0.9.9.18.1
2018 年 9 月 28 日
回复了 Wang1990 创建的主题 › 问与答 › 有偿征集店名,采用发 5000 利是
刺激吃鸡
2018 年 9 月 27 日
回复了 bbbai 创建的主题 › 程序员 › 一个 Java 的小问题
Effective Java 第三版第二章第一节有详细介绍

我简单摘录一下:

### 优点

One advantage of static factory methods is that, unlike constructors, they have names.

A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they ’ re invoked.

A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type.

A fourth advantage of static factories is that the class of the returned object can vary from call to call as a function of the input parameters.

A fifth advantage of static factories is that the class of the returned object need not exist when the class containing the method is written.

### 缺点

The main limitation of providing only static factory methods is that classes without public or protected constructors cannot be subclassed.

A second shortcoming of static factory methods is that they are hard for programmers to find.

### 一些常见的静态构造方法

**from**: A type-conversion method that takes a single parameter and returns a corresponding instance of this type, for example:

```java
Date d = Date.from(instant);
```

**of**: An aggregation method that takes multiple parameters and returns an instance of this type that incorporates them, for example:

```java
Set<Rank> faceCards = EnumSet.of(JACK, QUEEN, KING);
```

**valueOf**: A more verbose alternative to from and of, for example:

```java
BigInteger prime = BigInteger.valueOf(Integer.MAX_VALUE);
```

**instance** or **getInstance**: Returns an instance that is described by its parameters (if any) but cannot be said to have the same value, for example:

StackWalker luke = StackWalker.getInstance(options);

**create** or **newInstance**: Like instance or getInstance, except that the method guarantees that each call returns a new instance, for example:

```java
Object newArray = Array.newInstance(classObject, arrayLen);
```
根据我的实践,在 windows 上用 docker 最佳的方案是虚拟机,里面装个 Linux,然后再用 docker。虚拟化可以用 VirtualBox
2018 年 9 月 27 日
回复了 Sinar 创建的主题 › Java › Java 11 发布啦!
tls1.3 好评
2018 年 9 月 26 日
回复了 Livid 创建的主题 › Docker › docker compose 和 docker stack 的区别
又黑 Python
2018 年 9 月 21 日
回复了 baskice 创建的主题 › 问与答 › 有没有什么简单办法 log 本机 ip 传到服务器上?
写一个程序 post-ip,然后 ifconfig | post-ip,服务端再解析一下
1 ... 104  105  106  107  108  109  110  111  112  113 ... 148  
❮ ❯
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2375 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 42ms · UTC 03:22 · PVG 11:22 · LAX 19:22 · JFK 22:22
♥ Do have faith in what you're doing.