我试图计算列表中值的平方和.以下是三种变体,它们都计算出所需的值.我想知道哪一个最有效率.我期待第三个更高效,因为自动拳击只进行一次.
// 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) 我无法克隆新创建的存储库.我收到了以下错误.
$ 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) 我有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代码中的参数值转换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)
日期和时间格式信息:
java ×2
date ×1
git ×1
github ×1
java-8 ×1
java-stream ×1
maven-3 ×1
oracle ×1
performance ×1
sql ×1