本文整理汇总了Java中com.google.gwt.core.client.JsArrayBoolean类的典型用法代码示例。如果您正苦于以下问题:Java JsArrayBoolean类的具体用法?Java JsArrayBoolean怎么用?Java JsArrayBoolean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsArrayBoolean类属于com.google.gwt.core.client包,在下文中一共展示了JsArrayBoolean类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromBooleans
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
public static JsArrayBoolean fromBooleans(Collection<Boolean> collection) {
JsArrayBoolean array = JsArrayBoolean.createArray().cast();
for(Boolean item : collection) {
array.push(item);
}
return array;
}
示例2: toList
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
public static List<Boolean> toList(JsArrayBoolean array) {
List<Boolean> list = new ArrayList<>();
if(array != null) {
for (int i = 0; i < array.length(); i++) {
list.add(array.get(i));
}
}
return list;
}
示例3: fromArray
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
public static JsArrayBoolean fromArray(boolean... values) {
if (GWT.isScript()) {
return reinterpretCast(values);
} else {
JsArrayBoolean ret = JavaScriptObject.createArray().cast();
for (int i = 0, l = values.length; i < l; i++) {
ret.set(i, values[i]);
}
return ret;
}
}
示例4: toArray
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
public static boolean[] toArray(JsArrayBoolean values) {
if (GWT.isScript()) {
return reinterpretCast(values);
} else {
int length = values.length();
boolean[] ret = new boolean[length];
for (int i = 0, l = length; i < l; i++) {
ret[i] = values.get(i);
}
return ret;
}
}
示例5: wrapArray
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
/**
* Wraps a Java boolean Array to a JsArrayBoolean for dev mode.
*
* @param srcArray the array to wrap
* @return the wrapped array
*/
public static JsArrayBoolean wrapArray(boolean[] srcArray) {
JsArrayBoolean result = JavaScriptObject.createArray().cast();
for (int i = 0; i < srcArray.length; i++) {
result.set(i, srcArray[i]);
}
return result;
}
示例6: wrapArray
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
/**
* Wraps a Java boolean Array to a JsArrayBoolean.
*
* @param srcArray the array to wrap
* @return the wrapped array
*/
public static JsArrayBoolean wrapArray(boolean[] srcArray) {
if (GWT.isScript()) {
return arrayAsJsArrayForProdMode(srcArray);
}
JsArrayBoolean result = JavaScriptObject.createArray().cast();
for (int i = 0; i < srcArray.length; i++) {
result.set(i, srcArray[i]);
}
return result;
}
示例7: JsArrayIterator
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
public JsArrayIterator(JsArrayBoolean array) {
this((JavaScriptObject) array);
}
示例8: reinterpretCast
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
private static native JsArrayBoolean reinterpretCast(boolean[] value) /*-{
return value;
}-*/;
示例9: sort
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
/**
* Sorts a JsArray of booleans.
*
* @param sortMe Array to be sorted.
* @param comparator Comparator to be used, per native JS sort() method.
*/
public static native void sort(JsArrayBoolean sortMe, JavaScriptObject comparator) /*-{
sortMe.sort(comparator);
}-*/;
示例10: arrayAsJsArrayForProdMode
import com.google.gwt.core.client.JsArrayBoolean; //导入依赖的package包/类
/**
* Does the trick for production mode. In production mode, a JavaScript array is used for Java
* arrays. So we can directly use the array as JsArray. MUST NOT be called in dev mode.
*
* @param array the array to get the JsArray for
* @return an equivalent JsArray
*/
private static native JsArrayBoolean arrayAsJsArrayForProdMode(boolean[] array) /*-{
return array;
}-*/;