- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 18 for checkedCast (0.07 sec)
-
android/guava-tests/test/com/google/common/primitives/UnsignedIntsTest.java
for (long value : UNSIGNED_INTS) { assertThat(UnsignedInts.toLong(UnsignedInts.checkedCast(value))).isEqualTo(value); } assertCastFails(1L << 32); assertCastFails(-1L); assertCastFails(Long.MAX_VALUE); assertCastFails(Long.MIN_VALUE); } private static void assertCastFails(long value) { try { UnsignedInts.checkedCast(value); fail("Cast to int should have failed: " + value);
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 02:56:12 UTC 2024 - 12.5K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/primitives/UnsignedBytesTest.java
assertThat(UnsignedBytes.toInt((byte) -1)).isEqualTo(255); } public void testCheckedCast() { for (byte value : VALUES) { assertThat(UnsignedBytes.checkedCast(UnsignedBytes.toInt(value))).isEqualTo(value); } assertCastFails(256L); assertCastFails(-1L); assertCastFails(Long.MAX_VALUE); assertCastFails(Long.MIN_VALUE); }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 19:07:49 UTC 2024 - 13.4K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/primitives/CharsTest.java
for (char value : VALUES) { assertThat(Chars.hashCode(value)).isEqualTo(((Character) value).hashCode()); } } public void testCheckedCast() { for (char value : VALUES) { assertThat(Chars.checkedCast((long) value)).isEqualTo(value); } assertCastFails(GREATEST + 1L); assertCastFails(LEAST - 1L); assertCastFails(Long.MAX_VALUE); assertCastFails(Long.MIN_VALUE); }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 02:56:12 UTC 2024 - 25.6K bytes - Viewed (0) -
android/guava/src/com/google/common/primitives/SignedBytes.java
* @return the {@code byte} value that equals {@code value} * @throws IllegalArgumentException if {@code value} is greater than {@link Byte#MAX_VALUE} or * less than {@link Byte#MIN_VALUE} */ public static byte checkedCast(long value) { byte result = (byte) value; checkArgument(result == value, "Out of range: %s", value); return result; } /** * Returns the {@code byte} nearest in value to {@code value}. *
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Thu Oct 17 13:00:28 UTC 2024 - 7.3K bytes - Viewed (0) -
android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java
} assertTrue(Ordering.from(comparator).isOrdered(resultsForStrategy)); } if ((characteristics & Spliterator.SIZED) != 0) { assertEquals(Ints.checkedCast(estimatedSize), resultsForStrategy.size()); } assertEqualIgnoringOrder(elements, resultsForStrategy); resultsForAllStrategies.add(resultsForStrategy); } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Thu Oct 31 14:20:11 UTC 2024 - 12.5K bytes - Viewed (0) -
guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java
} assertTrue(Ordering.from(comparator).isOrdered(resultsForStrategy)); } if ((characteristics & Spliterator.SIZED) != 0) { assertEquals(Ints.checkedCast(estimatedSize), resultsForStrategy.size()); } assertEqualIgnoringOrder(elements, resultsForStrategy); resultsForAllStrategies.add(resultsForStrategy); } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Thu Oct 31 14:20:11 UTC 2024 - 12.1K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/primitives/IntsTest.java
for (int value : VALUES) { assertThat(Ints.hashCode(value)).isEqualTo(((Integer) value).hashCode()); } } public void testCheckedCast() { for (int value : VALUES) { assertThat(Ints.checkedCast((long) value)).isEqualTo(value); } assertCastFails(GREATEST + 1L); assertCastFails(LEAST - 1L); assertCastFails(Long.MAX_VALUE); assertCastFails(Long.MIN_VALUE); }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 02:56:12 UTC 2024 - 29.1K bytes - Viewed (0) -
android/guava/src/com/google/common/hash/BloomFilter.java
// 1 big endian int, the number of longs in our bitset // N big endian longs of our bitset DataOutputStream dout = new DataOutputStream(out); dout.writeByte(SignedBytes.checkedCast(strategy.ordinal())); dout.writeByte(UnsignedBytes.checkedCast(numHashFunctions)); // note: checked at the c'tor dout.writeInt(bits.data.length()); for (int i = 0; i < bits.data.length(); i++) { dout.writeLong(bits.data.get(i)); }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 23 16:45:30 UTC 2024 - 26.6K bytes - Viewed (0) -
android/guava/src/com/google/common/primitives/UnsignedInts.java
* @throws IllegalArgumentException if {@code value} is negative or greater than or equal to * 2<sup>32</sup> * @since 21.0 */ public static int checkedCast(long value) { checkArgument((value >> Integer.SIZE) == 0, "out of range: %s", value); return (int) value; } /**
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 30 21:17:54 UTC 2024 - 13.7K bytes - Viewed (0) -
guava/src/com/google/common/primitives/UnsignedInts.java
* @throws IllegalArgumentException if {@code value} is negative or greater than or equal to * 2<sup>32</sup> * @since 21.0 */ public static int checkedCast(long value) { checkArgument((value >> Integer.SIZE) == 0, "out of range: %s", value); return (int) value; } /**
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 30 21:17:54 UTC 2024 - 13.7K bytes - Viewed (0)