for (String fruit : list)
{
if("banane".equals(fruit))
list.remove(fruit);
System.out.println(fruit);
}
Run Code Online (Sandbox Code Playgroud)
这里有一个带删除指令的循环.在执行时,我在控制台输出下面得到一些ConcurrentModificationException:
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
at java.util.AbstractList$Itr.next(AbstractList.java:420)
at Boucle.main(Boucle.java:14)
abricot
banane
Run Code Online (Sandbox Code Playgroud)
问题:如何用循环删除一些元素?
我使用log4j来记录我的应用程序中的一些步骤.为了快速和肮脏,我使用:
org.apache.log4j.BasicConfigurator.configure();
Run Code Online (Sandbox Code Playgroud)
这将输出我在Eclipse控制台中的日志.
我想知道是否以及如何将级别阈值设置为高于DEBUG?换句话说,我不想显示DEBUG级别消息,只需显示ERR,WARN,INFO.
谢谢.
编辑: 我可以使用以下这个吗?
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
[...]
Logger logger = Logger.getLogger(this.class);
logger.setLevel(Level.INFO);
Run Code Online (Sandbox Code Playgroud) 我读了一些包含Scala源代码的java源代码.
我发现 Nil.$colon$colon(Object arg)
关键词$colon是什么意思?这条线意味着什么?
给定一个indexeddb数据库,其中一个声明的objectstore为:
var objectStore = thisDb.createObjectStore("table", {keyPath: "id", autoIncrement: true})
Run Code Online (Sandbox Code Playgroud)
当我使用添加请求添加新项目时:
var resp = objectStore.add(row)
Run Code Online (Sandbox Code Playgroud)
如何在onsuccess函数中获取此添加项的新ID?
resp.onsuccess = function(e) { /* code to get the id of the added item */}
Run Code Online (Sandbox Code Playgroud) 假设我们为todolist建立了一个数据库,并希望查询所有重要且尚未完成的项目.在SQL中,我将使用类似的东西
SELECT * FROM todolist WHERE important = true AND state <> 'done'
Run Code Online (Sandbox Code Playgroud)
我们如何在indexeddb nosql数据库中执行该类型的请求?有索引吗?其他方式?不可能?
据我所知过滤结果important = true:
objectstore.index('important').openCursor(IDBKeyRange.only('true'))
Run Code Online (Sandbox Code Playgroud)
但我不知道如何过滤,state <> 'done'因为我们只得到了IDBKeyRange.only(z).
我不知道如何过滤这两个条款.
注意:在MongoDB中我们做:
db.userdetails.find({"date_of_join" : "16/10/2010","education":"M.C.A."})
Run Code Online (Sandbox Code Playgroud) Documentum示例代码从未被深深评论过,所以我的问题是:
这条线是什么意思?
IDfQuery query = DfcUtils.getClientX().getQuery();
Run Code Online (Sandbox Code Playgroud) 我正在开发一个Ionic应用程序,我想通过config.xml在AndroidManifest.xml文件中添加android @ autoBackup =“ false”。根据cordova文档,cordova版本6.4在config.xml中支持edit-config标记,通过它我可以实现类似于plugin.xml的标记。
这就是我在config.xml文件中编写的内容。
<platform name="android">
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:autoBackup="false" />
</edit-config>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>
Run Code Online (Sandbox Code Playgroud)
它会像这样更改我的AndroidManifest.xml文件
<application android:autoBackup="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<application android:autoBackup="false" />
<activity android:exported="true" android:launchMode="singleTop" android:name="com.gae.scaffolder.plugin.FCMPluginActivity">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> …Run Code Online (Sandbox Code Playgroud) 我曾经有过这样的电话:
var link = $('<a />', { 'class': 'prop' + index, title: elt, text: elt });
link.on('click', switchLabel);
Run Code Online (Sandbox Code Playgroud)
用switchLabel如下:
function switchLabel(e) {
$('#' + this.className.replace('prop','corr')).text(this.title);
}
Run Code Online (Sandbox Code Playgroud)
我刚刚意识到this很难理解它在javascript中的含义,所以我用以下代码替换:
function switchLabel(e) {
var source = e.currentTarget;
$('#' + source.className.replace('prop','corr')).text(source.title);
}
Run Code Online (Sandbox Code Playgroud)
我对么?请在答案中添加一些解释,我们(js noobs)可以学习.
import java.util.*;
public class Metodo {
public static void main(String[] args) {
ArrayList<Integer> a = new ArrayList();
a.add(1);
a.add(2);
a.add(3);
a.add(4);
a.add(5);
Metodo.inverte(a);
for(int i=0; i<a.size(); i++) {
System.out.println(a.get(i));
}
}
public static void inverte(ArrayList<Integer> a) {
ArrayList<Integer> other = new ArrayList();
other = a;
for(int i=0; i<a.size(); i++) {
a.set(i, other.get(other.size()-i-1));
}
}
}
Run Code Online (Sandbox Code Playgroud)
此方法应该反转ArrayList中的数字,因此它应该打印"5 4 3 2 1",但它打印"5 4 3 4 5"而不是.为什么?
indexeddb ×2
java ×2
bytecode ×1
collections ×1
cordova ×1
dfc ×1
documentum ×1
javascript ×1
jquery ×1
log4j ×1
scala ×1
syntax ×1
where-clause ×1