本文整理匯總了Java中com.google.common.primitives.Ints.asList方法的典型用法代碼示例。如果您正苦於以下問題:Java Ints.asList方法的具體用法?Java Ints.asList怎麽用?Java Ints.asList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.primitives.Ints
的用法示例。
在下文中一共展示了Ints.asList方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deletecols
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
/**
* deletes all selected columns if it is not present in the <code>exp</code>
* List
*
* @param table the table to DELETE columns
* @param exp columns to avoid deleting
* @see #deletecol(javax.swing.JTable, int)
*/
static void deletecols(JTable table, int[] exp) {
Integer[] selcols;
try {
TableColumnModel tcm = table.getColumnModel();
selcols = ArrayUtils.toObject(table.getSelectedColumns());
Arrays.sort(selcols, Collections.reverseOrder());
List<Integer> explist = Ints.asList(exp);
for (int i : selcols) {
if (!explist.contains(i)) {
tcm.removeColumn(tcm.getColumn(i));
}
}
} catch (Exception e) {
Logger.getLogger(JtableUtils.class.getName()).log(Level.SEVERE, null, e);
}
}
示例2: getValues
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
static
public List<?> getValues(Tensor tensor){
DataType dataType = tensor.dataType();
switch(dataType){
case FLOAT:
return Floats.asList(TensorUtil.toFloatArray(tensor));
case DOUBLE:
return Doubles.asList(TensorUtil.toDoubleArray(tensor));
case INT32:
return Ints.asList(TensorUtil.toIntArray(tensor));
case INT64:
return Longs.asList(TensorUtil.toLongArray(tensor));
case STRING:
return Arrays.asList(TensorUtil.toStringArray(tensor));
case BOOL:
return Booleans.asList(TensorUtil.toBooleanArray(tensor));
default:
throw new IllegalArgumentException();
}
}
示例3: setUp
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@BeforeExperiment void setUp() {
this.striped = impl.get(numStripes);
stripes = new int[numStripes];
for (int i = 0; i < numStripes; i++) {
stripes[i] = i;
}
List<Integer> asList = Ints.asList(stripes);
Collections.shuffle(asList, new Random(0xdeadbeef));
// do bulk gets with exactly 10 keys (possibly <10 stripes) (or less if numStripes is smaller)
bulkGetSet = ImmutableList.copyOf(limit(cycle(asList), 10));
}
示例4:
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
public static Iterable<Integer> $in(int[] elements) {
return Ints.asList(elements);
}
示例5: setAcceptableCodes
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
public void setAcceptableCodes(final int[] acceptableCodes) {
this.acceptableCodes = Ints.asList(acceptableCodes);
}
示例6: serialize
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
@Override public void serialize(TypeToken<?> type, int[] obj, ConfigurationNode value) throws ObjectMappingException {
List<Integer> bytes = Ints.asList(obj);
value.setValue(ttlb, bytes);
}
示例7: intAsList
import com.google.common.primitives.Ints; //導入方法依賴的package包/類
/**
* Arrays.asList()的加強版, 返回一個底層為原始類型int的List
*
* 與保存Integer相比節約空間,同時隻在讀取數據時AutoBoxing.
*
* @see java.util.Arrays#asList(Object...)
* @see com.google.common.primitives.Ints#asList(int...)
*
*/
public static List<Integer> intAsList(int... backingArray) {
return Ints.asList(backingArray);
}