Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 29 for checkedCast (0.74 sec)

  1. 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}.
       *
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Apr 22 13:09:25 GMT 2021
    - 7.5K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/primitives/ShortsTest.java

        for (short value : VALUES) {
          assertThat(Shorts.hashCode(value)).isEqualTo(((Short) value).hashCode());
        }
      }
    
      public void testCheckedCast() {
        for (short value : VALUES) {
          assertThat(Shorts.checkedCast((long) value)).isEqualTo(value);
        }
        assertCastFails(GREATEST + 1L);
        assertCastFails(LEAST - 1L);
        assertCastFails(Long.MAX_VALUE);
        assertCastFails(Long.MIN_VALUE);
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Thu Feb 29 15:43:06 GMT 2024
    - 26.6K bytes
    - Viewed (0)
  3. 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);
          }
        }
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 22 18:19:31 GMT 2024
    - 11.9K bytes
    - Viewed (0)
  4. guava/src/com/google/common/collect/DiscreteDomain.java

          int i = value;
          return (i == Integer.MIN_VALUE) ? null : i - 1;
        }
    
        @Override
        Integer offset(Integer origin, long distance) {
          checkNonnegative(distance, "distance");
          return Ints.checkedCast(origin.longValue() + distance);
        }
    
        @Override
        public long distance(Integer start, Integer end) {
          return (long) end - start;
        }
    
        @Override
        public Integer minValue() {
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Thu Feb 22 21:19:52 GMT 2024
    - 10.3K bytes
    - Viewed (0)
  5. 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));
        }
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 23.1K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/hash/BloomFilterStrategies.java

          // Avoid delegating to this(long[]), since AtomicLongArray(long[]) will clone its input and
          // thus double memory usage.
          this.data =
              new AtomicLongArray(Ints.checkedCast(LongMath.divide(bits, 64, RoundingMode.CEILING)));
          this.bitCount = LongAddables.create();
        }
    
        // Used by serialization
        LockFreeBitArray(long[] data) {
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Oct 10 19:45:10 GMT 2022
    - 10.7K bytes
    - Viewed (0)
  7. 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);
      }
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Tue Feb 06 16:10:08 GMT 2024
    - 28.4K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/primitives/ShortsTest.java

        for (short value : VALUES) {
          assertThat(Shorts.hashCode(value)).isEqualTo(((Short) value).hashCode());
        }
      }
    
      public void testCheckedCast() {
        for (short value : VALUES) {
          assertThat(Shorts.checkedCast((long) value)).isEqualTo(value);
        }
        assertCastFails(GREATEST + 1L);
        assertCastFails(LEAST - 1L);
        assertCastFails(Long.MAX_VALUE);
        assertCastFails(Long.MIN_VALUE);
      }
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Feb 29 15:43:06 GMT 2024
    - 26.6K bytes
    - Viewed (0)
  9. 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;
      }
    
      /**
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Feb 15 16:12:13 GMT 2024
    - 13.4K bytes
    - Viewed (0)
  10. 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);
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Tue Feb 06 16:10:08 GMT 2024
    - 28.4K bytes
    - Viewed (0)
Back to top