小编Joh*_*iva的帖子

在mapToInt之后调用map是否有任何优势,如果需要的话

我试图计算列表中值的平方和.以下是三种变体,它们都计算出所需的值.我想知道哪一个最有效率.我期待第三个更高效,因为自动拳击只进行一次.

    // sum of squares
    int sum = list.stream().map(x -> x * x).reduce((x, y) -> x + y).get();
    System.out.println("sum of squares: " + sum);

    sum = list.stream().mapToInt(x -> x * x).sum();
    System.out.println("sum of squares: " + sum);

    sum = list.stream().mapToInt(x -> x).map(x -> x * x).sum();
    System.out.println("sum of squares: " + sum);
Run Code Online (Sandbox Code Playgroud)

java performance java-8 java-stream

10
推荐指数
1
解决办法
1621
查看次数

我在git clone上得到500错误

我无法克隆新创建的存储库.我收到了以下错误.

$ git clone https://github.xxxxx.com/zzzzzz.git
Cloning into 'zzzzzz'...
Username for 'https://github.xxxxxx.com': yyyyy
Password for 'https://yyyyy@github.xxxxxx.com':
remote: Internal Server Error.
remote:
fatal: unable to access 'https://github.xxxxxx.com/zzzzz.git/': The requested URL returned error: 500
Run Code Online (Sandbox Code Playgroud)

我已经成功生成了ssh密钥,并根据以下URL中的说明更新了github设置中的密钥

https://help.github.com/articles/generating-ssh-keys/

执行命令时,身份验证成功:git -T git@github.xxx.com

另外根据我的理解,如果我们设置ssh,git clone命令不应该要求用户名和密码.但它仍然要求他们.

debug1: Authentication succeeded (publickey).
Authenticated to github.xxxxx.com ([10.28.22.44]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access. 
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3880, received 1696 bytes, …
Run Code Online (Sandbox Code Playgroud)

git github

8
推荐指数
1
解决办法
4万
查看次数

IBM Java 1.6.0和maven 3.3.3中的UnsupportedClassVersionError

我有IBM Java 1.6.0和maven 3.3.3的环境.

当我运行mvn clean install时,我得到以下错误.

Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/maven/cli/MavenCli, offset=6
    at java.lang.ClassLoader.defineClass(ClassLoader.java:262)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:540)
Run Code Online (Sandbox Code Playgroud)

java maven-3

5
推荐指数
1
解决办法
8479
查看次数

ORA-01821:ISO 8601日期与当地时间的日期格式无法识别错误

我试图根据我的Java代码中的参数值转换SQL中的日期.但是,当执行以下查询时,我收到错误.请求您帮我修复此查询.

 SELECT TO_DATE ('2015-08-26T05:46:30.488+0100',
 'YYYY-MM-DD"T"hh24:mi:ss.sTZH:TZM')
  FROM DUAL
  *
Error at line 2
ORA-01821: date format not recognized
Run Code Online (Sandbox Code Playgroud)

日期和时间格式信息:

http://www.w3.org/TR/NOTE-datetime

sql oracle date

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

java ×2

date ×1

git ×1

github ×1

java-8 ×1

java-stream ×1

maven-3 ×1

oracle ×1

performance ×1

sql ×1