Java Code Examples for com.google.common.primitives.Ints.asList()

The following are Jave code examples for showing how to use asList() of the com.google.common.primitives.Ints class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Cognizant-Intelligent-Test-Scripter   File: JtableUtils.java   View Source Code Vote up 6 votes
/**
 * 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);
    }

}
 
Example 2
Project: jpmml-tensorflow   File: TensorUtil.java   View Source Code Vote up 6 votes
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();
	}
}
 
Example 3
Project: guava-mock   File: StripedBenchmark.java   View Source Code Vote up 5 votes
@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));
}
 
Example 4
Project: googles-monorepo-demo   File: StripedBenchmark.java   View Source Code Vote up 5 votes
@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));
}
 
Example 5
Project: GitHub   File: Intrinsics.java   View Source Code Vote up 4 votes
public static Iterable<Integer> $in(int[] elements) {
  return Ints.asList(elements);
}
 
Example 6
Project: springboot-shiro-cas-mybatis   File: SimpleHttpClientFactoryBean.java   View Source Code Vote up 4 votes
public void setAcceptableCodes(final int[] acceptableCodes) {
    this.acceptableCodes = Ints.asList(acceptableCodes);
}
 
Example 7
Project: springboot-shiro-cas-mybatis   File: SimpleHttpClientFactoryBean.java   View Source Code Vote up 4 votes
public void setAcceptableCodes(final int[] acceptableCodes) {
    this.acceptableCodes = Ints.asList(acceptableCodes);
}
 
Example 8
Project: cas-server-4.2.1   File: SimpleHttpClientFactoryBean.java   View Source Code Vote up 4 votes
public void setAcceptableCodes(final int[] acceptableCodes) {
    this.acceptableCodes = Ints.asList(acceptableCodes);
}
 
Example 9
Project: Neutrino   File: IntArrayTypeSerialiser.java   View Source Code Vote up 4 votes
@Override public void serialize(TypeToken<?> type, int[] obj, ConfigurationNode value) throws ObjectMappingException {
    List<Integer> bytes = Ints.asList(obj);
    value.setValue(ttlb, bytes);
}
 
Example 10
Project: util   File: ArrayUtil.java   View Source Code Vote up 2 votes
/**
 * 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);
}