假设我们有一个队列
BlockingQueue<String> queue= new LinkedBlockingQueue<>();
Run Code Online (Sandbox Code Playgroud)
而其他一些线程将值放入其中,然后我们就像读取它一样
while (true) {
String next = queue.take();
System.out.println("next message:" + next);
}
Run Code Online (Sandbox Code Playgroud)
如何以流样式迭代此队列,同时保持与上述代码类似的语义.
此代码仅遍历当前队列状态:
queue.stream().forEach(e -> System.out.println(e));
Run Code Online (Sandbox Code Playgroud) 我有一个使用Android Studio 0.8.1构建的Android应用程序并面临此问题:
Error:Execution failed for task ':app:preDexDebug'.
> java.lang.IllegalArgumentException: Source C:\Users\mfedorov\AndroidStudioProjects\EPOS2\app\build\intermediates\pre-dexed\debug\mate-api-0.0.1-SNAPSHOT-0ef7e3259aeaf19202f545da97dc6b1ae2502c9a.jar and destination C:\Users\mfedorov.ALTIUS-PLUS\AndroidStudioProjects\EPOS2\app\build\intermediates\pre-dexed\debug\mate-api-0.0.1-SNAPSHOT-0ef7e3259aeaf19202f545da97dc6b1ae2502c9a.jar must be different
Run Code Online (Sandbox Code Playgroud)
这是我的build.gradle文件内容(我已经更改的部分,其余部分是默认的)
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.apache.commons:commons-collections4:4.0'
compile 'org.slf4j:slf4j-android:1.7.7'
compile 'com.altius.logging:logging-utils:0.0.1-SNAPSHOT'
compile group: "com.altius.mate", name: "mate-bluetooth", version: "0.0.1-SNAPSHOT", changing: true
compile group: "com.altius.mate", name: "mate-api", version: "0.0.1-SNAPSHOT", changing: true
//compile('org.simpleframework:simple-xml:2.7.1') {
//exclude group: 'stax', module: 'stax-api'
//exclude group: 'xpp3', module: 'xpp3'
//}
}
Run Code Online (Sandbox Code Playgroud)
root build.gradle的内容默认为使用android项目创建的
mate-api-0.0.1-SNAPSHOT工件来自Maven本地存储库 mavenLocal()
有没有什么简短的方法可以将java.time.ZonedDateTime转换为XMLGregorianCalendar?
也许我需要一些中间步骤,比如将ZonedDateTime转换为java.util.Date,但这会使代码过于混乱.
问题出现在JAX-WS Web服务中,datetime作为XMLGregorianCalendar传递.
我在我的 Android 应用程序中使用 slf4j-android。医生说如果我写log.trace那么它和我写的几乎一样Log.v。但是默认的日志级别似乎是 INFO,而 logcat 只显示log.info及以上,我看不到如何更改默认值。
1) 如何配置 slf4j-android
2)如果我不能:是否还有其他适用于 Android 的 slf4j 实现,更可配置
如何获取应用Spring Boot(自动或非自动)配置的列表?