本文整理了Java中org.stjs.javascript.Array.indexOf()
方法的一些代码示例,展示了Array.indexOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.indexOf()
方法的具体详情如下:
包路径:org.stjs.javascript.Array
类名称:Array
方法名:indexOf
[英]Searches this Array for the specified item, and returns its position. Items are compared for equality using the === operator.
The search will start at the beginning and end at the end of the Array.
Returns -1 if the item is not found.
If the item is present more than once, indexOf returns the position of the first occurrence.
[中]在此数组中搜索指定项,并返回其位置。使用===运算符比较项目是否相等。
搜索将从数组的开始和结束处开始。
如果未找到项,则返回-1。
如果项目多次出现,indexOf将返回第一次出现的位置。
代码示例来源:origin: org.st-js/shared
/**
* Searches this <tt>Array</tt> for the specified item, and returns its position. Items are compared for equality
* using the === operator.
*
* <p>
* The search will start at the beginning and end at the end of the <tt>Array</tt>.
*
* <p>
* Returns -1 if the item is not found.
*
* <p>
* If the item is present more than once, <tt>indexOf</tt> returns the position of the first occurrence.
*
* @param element
* the item to search for
* @return the index at which the element was found, -1 if not found
*/
@BrowserCompatibility("IE:9+")
public int indexOf(V element) {
return indexOf(element, 0);
}
代码示例来源:origin: com.eduworks/org.cassproject.schema.general
/**
* Return the URL Base portion of the short ID.
*
* @return {string} Server Base URL of the linked data object.
* @method getServerBaseUrl
*/
public String getServerBaseUrl() {
String shortId = trimVersionFromUrl(id);
Array<String> parts = (Array<String>) (Object) shortId.split("/");
return parts.slice(0, parts.indexOf("data")).join("/");
}
代码示例来源:origin: org.st-js/shared
return indexOf(searchElement, iter);
代码示例来源:origin: org.st-js/shared
return indexOf(element, iter);
代码示例来源:origin: com.eduworks/cass.competency
@Override
public void $invoke(Array<EcRemoteLinkedData> p1) {
if (success != null) {
Array<EcAlignment> ret = JSCollections.$array();
for (int i = 0; i < p1.$length(); i++) {
EcAlignment alignment = new EcAlignment();
if (p1.$get(i).isAny(alignment.getTypes())) {
alignment.copyFrom(p1.$get(i));
} else if (p1.$get(i).isA(EcEncryptedValue.myType)) {
EcEncryptedValue val = new EcEncryptedValue();
val.copyFrom(p1.$get(i));
if (val.isAnEncrypted(EcAlignment.myType)) {
EcRemoteLinkedData obj = val.decryptIntoObject();
if (sourceIds.indexOf((String) JSObjectAdapter.$get(obj, "source")) == -1 && finalNoVersions.indexOf((String) JSObjectAdapter.$get(obj, "source")) == -1) {
continue;
}
alignment.copyFrom(obj);
}
}
ret.$set(i, alignment);
}
success.$invoke(ret);
}
}
内容来源于网络,如有侵权,请联系作者删除!