java.util.concurrent.atomic.AtomicInteger#intValue()源码实例Demo

下面列出了java.util.concurrent.atomic.AtomicInteger#intValue() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: RankSys   文件: SimplePreferenceData.java
/**
 * Loads an instance of the class from a stream of tuples possibly containing extra information.
 *
 * @param <U> type of user
 * @param <I> type of item
 * @param <O> type of additional information
 * @param tuples stream of user-item-value triples
 * @param uPrefFun creator of preference objects
 * @param iPrefFun creator of preference objects
 * @return a preference data object
 */
public static <U, I, O> SimplePreferenceData<U, I> load(Stream<Tuple4<U, I, Double, O>> tuples,
                                                        Function4<U, I, Double, O, ? extends IdPref<I>> uPrefFun,
                                                        Function4<U, I, Double, O, ? extends IdPref<U>> iPrefFun) {
    AtomicInteger numPreferences = new AtomicInteger(0);
    Map<U, List<IdPref<I>>> userMap = new HashMap<>();
    Map<I, List<IdPref<U>>> itemMap = new HashMap<>();

    tuples.forEach(t -> {
        numPreferences.incrementAndGet();
        userMap.computeIfAbsent(t.v1, v1 -> new ArrayList<>()).add(uPrefFun.apply(t));
        itemMap.computeIfAbsent(t.v2, v2 -> new ArrayList<>()).add(iPrefFun.apply(t));
    });

    return new SimplePreferenceData<>(userMap, itemMap, numPreferences.intValue());
}
 
源代码2 项目: android-open-project-demo   文件: InsertQueue.java
/**
 * Inserts pending items into the Insertable, and adds them to the active positions (correctly managing position shifting). Clears the pending items.
 */
private void insertPending() {
    for (Pair<Integer, T> pi : mPendingItemsToInsert) {
        for (AtomicInteger existing : mActiveIndexes) {
            if (existing.intValue() >= pi.first) {
                existing.incrementAndGet();
            }
        }
        mActiveIndexes.add(new AtomicInteger(pi.first));
        mInsertable.add(pi.first, pi.second);
    }
    mPendingItemsToInsert.clear();
}
 
源代码3 项目: openjdk-8   文件: bug7068740.java
private static int getSelectedRow() throws Exception {
    final AtomicInteger row = new AtomicInteger(-1);
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            row.set(table.getSelectedRow());
        }
    });
    return row.intValue();
}
 
源代码4 项目: ListViewAnimations   文件: Matchers.java
@Override
protected boolean matchesSafely(final AtomicInteger item) {
    return mValue == item.intValue();
}
 
源代码5 项目: sarl   文件: AtomicIntegerArithmeticExtensions.java
/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.intValue() / $2)", constantExpression = true)
public static int operator_divide(AtomicInteger left, byte right) {
	return left.intValue() / right;
}
 
源代码6 项目: sarl   文件: AtomicIntegerArithmeticExtensions.java
/** The binary {@code multiply} operator. This is the equivalent to
 * the Java {@code *} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left*right}
 */
@Pure
@Inline(value = "($1.intValue() * $2.byteValue())", constantExpression = true)
public static int operator_multiply(AtomicInteger left, Byte right) {
	return left.intValue() * right.byteValue();
}
 
源代码7 项目: sarl   文件: AtomicIntegerComparisonExtensions.java
/** The binary {@code lessThan} operator. This is the equivalent to
 * the Java {@code &lt;} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&lt;right}
 */
@Pure
@Inline(value = "($1.intValue() < $2)", constantExpression = true)
public static boolean operator_lessThan(AtomicInteger left, short right) {
	return left.intValue() < right;
}
 
源代码8 项目: sarl   文件: PrimitiveShortArithmeticExtensions.java
/** The binary {@code minus} operator. This is the equivalent to
 * the Java {@code -} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left-right}
 */
@Pure
@Inline(value = "($1 - $2.intValue())", constantExpression = true)
public static int operator_minus(short left, AtomicInteger right) {
	return left - right.intValue();
}
 
源代码9 项目: sarl   文件: ByteArithmeticExtensions.java
/** The binary {@code plus} operator. This is the equivalent to
 * the Java {@code +} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left+right}
 */
@Pure
@Inline(value = "($1.byteValue() + $2.intValue())", constantExpression = true)
public static int operator_plus(Byte left, AtomicInteger right) {
	return left.byteValue() + right.intValue();
}
 
源代码10 项目: sarl   文件: FloatArithmeticExtensions.java
/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.floatValue() / $2.intValue())", constantExpression = true)
public static float operator_divide(Float left, AtomicInteger right) {
	return left.floatValue() / right.intValue();
}
 
源代码11 项目: sarl   文件: PrimitiveLongArithmeticExtensions.java
/** The binary {@code multiply} operator. This is the equivalent to
 * the Java {@code *} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left*right}
 */
@Pure
@Inline(value = "($1 * $2.intValue())", constantExpression = true)
public static long operator_multiply(long left, AtomicInteger right) {
	return left * right.intValue();
}
 
源代码12 项目: sarl   文件: AtomicIntegerComparisonExtensions.java
/** The binary {@code greaterEqualsThan} operator. This is the equivalent
 * to the Java {@code &gt;=} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;=right}
 */
@Pure
@Inline(value = "($1.intValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicInteger left, byte right) {
	return left.intValue() >= right;
}
 
源代码13 项目: sarl   文件: AtomicIntegerArithmeticExtensions.java
/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.intValue() / $2)", constantExpression = true)
public static float operator_divide(AtomicInteger left, float right) {
	return left.intValue() / right;
}
 
源代码14 项目: sarl   文件: PrimitiveShortArithmeticExtensions.java
/** The binary {@code modulo} operator. This is the equivalent to
 * the Java {@code %} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left%right}
 */
@Pure
@Inline(value = "($1 % $2.intValue())", constantExpression = true)
public static int operator_modulo(short left, AtomicInteger right) {
	return left % right.intValue();
}
 
源代码15 项目: sarl   文件: AtomicIntegerArithmeticExtensions.java
/** The binary {@code plus} operator. This is the equivalent to
 * the Java {@code +} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left+right}
 */
@Pure
@Inline(value = "($1.intValue() + $2.intValue())", constantExpression = true)
public static int operator_plus(AtomicInteger left, AtomicInteger right) {
	return left.intValue() + right.intValue();
}
 
源代码16 项目: sarl   文件: AtomicIntegerComparisonExtensions.java
/**
 * The binary {@code equals} operator. This is the equivalent to the Java {@code ==} operator.
 * This function is null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left==right}
 */
@Pure
@Inline(value = "($1 != null ? ($1.intValue() == $2) : false)", constantExpression = true)
public static boolean operator_equals(AtomicInteger left, byte right) {
	return left != null ? left.intValue() == right : false;
}
 
源代码17 项目: sarl   文件: AtomicIntegerArithmeticExtensions.java
/** The binary {@code divide} operator. This is the equivalent to
 * the Java {@code /} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left/right}
 */
@Pure
@Inline(value = "($1.intValue() / $2)", constantExpression = true)
public static int operator_divide(AtomicInteger left, int right) {
	return left.intValue() / right;
}
 
源代码18 项目: sarl   文件: AtomicIntegerComparisonExtensions.java
/** The binary {@code greaterThan} operator. This is the equivalent
 * to the Java {@code &gt;} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;right}
 */
@Pure
@Inline(value = "($1.intValue() > $2)", constantExpression = true)
public static boolean operator_greaterThan(AtomicInteger left, int right) {
	return left.intValue() > right;
}
 
源代码19 项目: sarl   文件: PrimitiveIntArithmeticExtensions.java
/** The binary {@code multiply} operator. This is the equivalent to
 * the Java {@code *} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left*right}
 */
@Pure
@Inline(value = "($1 * $2.intValue())", constantExpression = true)
public static int operator_multiply(int left, AtomicInteger right) {
	return left * right.intValue();
}
 
源代码20 项目: sarl   文件: IntegerArithmeticExtensions.java
/** The binary {@code minus} operator. This is the equivalent to
 * the Java {@code -} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left-right}
 */
@Pure
@Inline(value = "($1.intValue() - $2.intValue())", constantExpression = true)
public static int operator_minus(Integer left, AtomicInteger right) {
	return left.intValue() - right.intValue();
}