V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  Cbdy  ›  全部回复第 102 页 / 共 142 页
回复总数  2821
1 ... 98  99  100  101  102  103  104  105  106  107 ... 142  
2018-09-28 15:02:40 +08:00
回复了 Wang1990 创建的主题 问与答 有偿征集店名,采用发 5000 利是
刺激吃鸡
2018-09-27 19:08:13 +08:00
回复了 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-09-27 06:44:18 +08:00
回复了 Sinar 创建的主题 Java Java 11 发布啦!
tls1.3 好评
2018-09-26 06:07:07 +08:00
回复了 Livid 创建的主题 Docker docker compose 和 docker stack 的区别
又黑 Python
2018-09-21 08:04:47 +08:00
回复了 baskice 创建的主题 问与答 有没有什么简单办法 log 本机 ip 传到服务器上?
写一个程序 post-ip,然后 ifconfig | post-ip,服务端再解析一下
2018-09-18 07:09:34 +08:00
回复了 caiem 创建的主题 程序员 有个高并发接口,需要即时获取访问者的 ip 信息
MySQL 放内存里跑
2018-09-17 12:53:04 +08:00
回复了 ColinZeb 创建的主题 汽车 当了一次马路杀手
1. 提前操作
2. 按道行驶
3. 远离大车
4. 买好保险
加班两天换一天调休还行,老东家也是这样
周末一换一,周天二换一
2018-09-13 15:54:49 +08:00
回复了 annya 创建的主题 问与答 迫于实在没啥好想法,求推荐送男生礼物!!
年轻人的第一台。。。无人机?
2018-09-13 07:53:16 +08:00
回复了 carrieflint 创建的主题 分享发现 [征集贴] 来给 FydeOS 取中文名吧!
飞飞,叠字多好听
2018-09-12 09:00:30 +08:00
回复了 allen945 创建的主题 程序员 你们怎么看待开源?开源项目被私自删除版权好无奈
可以不开源
2018-09-07 07:31:19 +08:00
回复了 MuscleOf2016 创建的主题 前端开发 关于项目使用 ts 改造的一点疑问?
用 webpack+webpack-serve,感觉还行
2018-09-06 15:53:59 +08:00
回复了 paodange 创建的主题 求职 提出辞职,公司不同意有没有什么好的办法?
和下家公司谈,推迟入职时间,如果真的想招你,不差这点时间

另,普通岗位离职不需要别人“同意”,你只需要发出“通知”,然后在一个月内做好交接就可以了
2018-09-06 14:23:48 +08:00
回复了 twogoods 创建的主题 问与答 为什么要用数据库连接池
数据库事务会占用一个数据库连接
2018-09-05 07:06:15 +08:00
回复了 cc959798 创建的主题 问与答 请问怎样高效的学习正则表达式
去了解正则的原理,比如自己写一个正则解析器
Jira + Confluence
不过如果都是程序员,用 Issue 是 OK 的

“有了 gitlab,不想再搞一个 bug 管理工具了”,这是什么思维?
2018-09-03 22:49:46 +08:00
回复了 ivmm 创建的主题 数据库 MariaDB/MySQL vs PostgreSQL 世纪大决战 这个标题看看就刺激
没卵用,那个流行用哪个,所以我用 MySQL
1 ... 98  99  100  101  102  103  104  105  106  107 ... 142  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   726 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 62ms · UTC 21:35 · PVG 05:35 · LAX 14:35 · JFK 17:35
Developed with CodeLauncher
♥ Do have faith in what you're doing.